|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_ITERATOR_EULERTOUR_H_
2 #define GENESIS_TREE_ITERATOR_EULERTOUR_H_
39 #include <type_traits>
58 template<
bool is_const = true >
69 using TreeType =
typename std::conditional< is_const, Tree const, Tree >::type;
70 using LinkType =
typename std::conditional< is_const, TreeLink const, TreeLink >::type;
71 using NodeType =
typename std::conditional< is_const, TreeNode const, TreeNode >::type;
72 using EdgeType =
typename std::conditional< is_const, TreeEdge const, TreeEdge >::type;
91 : link_( &tree.root_link() )
92 , start_( &tree.root_link() )
96 : link_( &
node.primary_link() )
97 , start_( &
node.primary_link() )
109 : link_( &(subtree.
link().next()) )
110 , start_( (link_ == &link_->next()) ? &(subtree.
link().outer().next()) : &(subtree.
link()) )
132 link_ = &link_->outer().next();
133 if( link_ == start_ ) {
148 return other.link_ == link_;
153 return !(other == *
this);
162 return link_ == start_;
172 return link_->node();
177 return link_->edge();
187 return start_->node();
204 template<
typename ElementType>
214 template<
typename ElementType>
227 #endif // include guard
~IteratorEulertour()=default
std::forward_iterator_tag iterator_category
bool operator==(const self_type &other) const
typename std::conditional< is_const, TreeNode const, TreeNode >::type NodeType
IteratorEulertour & operator=(IteratorEulertour const &)=default
Reference to a subtree of a Tree.
Simple wrapper for typical begin() and end() iterators, to be used in range-based for loops.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
IteratorEulertour(NodeType &node)
typename std::conditional< is_const, Tree const, Tree >::type TreeType
typename std::conditional< is_const, TreeEdge const, TreeEdge >::type EdgeType
bool operator!=(const self_type &other) const
bool is_first_iteration() const
utils::Range< IteratorEulertour< true > > eulertour(ElementType const &element)
NodeType & start_node() const
typename std::conditional< is_const, TreeLink const, TreeLink >::type LinkType
IteratorEulertour(LinkType &link)
IteratorEulertour(Subtree const &subtree)
IteratorEulertour(TreeType &tree)
LinkType & start_link() const