|
Boost : |
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-07-10 11:39:25
The traversal library that has been discussed allows tree-like traversal
of structures using a functional approach.
I suggest an alternative approach: a range-based one.
It certainly has limitations: ranges are monomorphic. So you can only do
it if is_same< typename range_value<Range>::type, typename range_value<
typename range_value<Range> >::type >.
However, it would be very practical to use, since you could simply use a
foreach loop to perform depth-first search and stop iteration whenever
you like.
Also, it is lazy and you can combine it easily with other range adaptors
(filtering, transforming...) or algorithms.
For performance, one would need to provide a way to get the father range
of a given range. Maybe that's the occasion to create a new concept.
Otherwise iterators will need to have their own stack.
Did anyone ever work on that? Does it look like a good idea?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk