Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-10-10 09:28:09


Kasper Peeters wrote:

>I have written a templated 'tree' container class which has been
>available for some time under the GPL. Every node in the tree can have
>an arbitrary number of children, and iterators are present for
>depth-first traversal of the entire tree or for traversal of only a
>range of nodes which are siblings of each other.
>
>
>
Thanks. I may be able to use it somewhere in the
http://groups.yahoo.com/group/boost/files/shared_cyclic_ptr/
shared_cyclic_ptr.zip. In particular, I'd like some way
to generalize the iterator's in
cyclic_global_mark_sweep_count_ip_offset_iterator.hpp.
If you look at the code, you can see that it traverses the tree
in depth-first order, but uses recursion.

On another topic, you might find the boost/col_io subdirectory of
the above zip file. The statement:

   mout()+=tr.depth(it)-rootdepth

could replace the following code in .../kp229/tree/test_tree.cc:
  for(int i=0; i<tr.depth(it)-rootdepth; ++i)
     std::cout << " ";


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk