Boost logo

Boost :

Subject: Re: [boost] [fusion] segmented fusion 2.0
From: Eric Niebler (eric_at_[hidden])
Date: 2011-08-11 11:56:28


On 8/11/2011 2:18 AM, Mathias Gaunard wrote:
> On 08/11/2011 06:28 AM, Eric Niebler wrote:
>
>> Also, some containers and views are naturally segmented, like
>> joint_view. Practically all of joint_view's implementation, including
>> its iterator, would vanish if it just advertised itself as segmented.
>>
>> Thoughts? Objections?
>
> I don't think the flat iterator of joint_view should disappear.
> A segmented fusion sequence should also be iterable like a flat fusion
> sequence if I'm willing to pay the price.

And it won't! That's the great thing ... one segmented_iterator class
template is sufficient to present a flat view of *any* hierarchical data
structure. It knows how to walk the tree of internal segments.
Internally, it remembers the path it took through the tree to reach the
current position. (I'm using "tree" generally here. A joint_view is just
a very simple tree.)

And, when you make a range out of two of these segmented iterators, you
are essentially defining another hierarchical data structure -- a
constrained view of the original container, delimited by the two paths
that each iterator represents. You can pass this range to a segmented
algorithm, and it does the segmented thing instead of the iterative thing.

-- 
Eric Niebler
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