26 #ifndef MLN_UTIL_BRANCH_ITER_IND_HH
27 # define MLN_UTIL_BRANCH_ITER_IND_HH
37 # include <mln/util/tree.hh>
47 typedef std::vector< util::tree_node<T>* > child_list;
49 bi_elt(child_list* list)
55 util::tree_node<T>* previous_;
95 std::stack< bi_elt<T> > s_;
100 # ifndef MLN_INCLUDE_ONLY
103 template <
typename T>
111 template <
typename T>
119 template <
typename T>
128 template <
typename T>
133 mln_assertion(is_valid());
144 template <
typename T>
152 template <
typename T>
161 template <
typename T>
166 s_.push(bi_elt<T>(&branch_.apex().children()));
168 n_ = &branch_.apex();
171 template <
typename T>
184 if (s_.top().list_->size() == (unsigned)s_.top().pos_)
192 mln_assertion(s_.top().list_->size() > (unsigned)s_.top().pos_);
193 if (s_.top().previous_ != 0)
194 mln_assertion(s_.top().previous_ == (*(s_.top().list_))[s_.top().pos_ - 1]);
196 n_ = (*(s_.top().list_))[s_.top().pos_];
197 s_.top().previous_ = n_;
206 if (n_->children().size() > 0)
208 s_.push(bi_elt<T>(&n_->children()));
215 # endif // ! MLN_INCLUDE_ONLY
223 #endif // ! MLN_UTIL_BRANCH_ITER_IND_HH