From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-07-10 23:14:47
David Abrahams wrote:
> This sounds a bit like http://lafstern.org/matt/segmented.pdf
> Did you have something like that in mind?
I was more thinking of an iterator that does the job.
Basically, an iterator like this (succint pseudo code):
current = first_child(current);
while(current != root && !has_sibling(current))
current = father(current);
if(current != root)
current = next_sibling(current);
value_type dereference() const
Only father is really needed within those primitives.
That way you can simply write
foreach(value_type v, make_tree_range(range))
and it automatically does an efficient depth-first search.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk