Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-07-10 20:26:37


on Thu Jul 10 2008, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:

> 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?

This sounds a bit like http://lafstern.org/matt/segmented.pdf
Did you have something like that in mind?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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