logo       

Re: segmented fusion - a-ha!: msg#00058

parsers.spirit.devel

Subject: Re: segmented fusion - a-ha!

Eric Niebler wrote:

I just had an a-ha! moment. Segmentation in Fusion is *so* much simpler than I was making it. Fusion doesn't need segmented iterators, it needs segmented sequences! Fusion's algorithms don't take iterators like the std algorithms do -- they take sequences. I was trying to shoe-horn Matt Austern's formulation into Fusion, but that's the wrong approach.

Consider the joint_view. It should advertise itself as a segmented view. Then, the only thing it needs to provide is a way to step through the internal segments -- which are Fusion sequences that may or may not be segmented. What you get, essentially, is:

Yeah! This is "make it as simple as possible" thing that I was
looking for. Essentially, segmented sequences are sequences with
child sequences (segments). I see:

traits::is_segmented<Seq>::type // --> mpl::true_/false_

Then for segmented sequences:

segments(seq) // --> a sequence of sequences
result_of::segments<Seq>::type // --> a sequence of sequences type

Now, a joint_view can hold and return a vector2<Sequence1, Sequence2>&
when its intrinsic "segments" is called (via tag-dispatch).

Now, if for_each was an object (ala Fusion1), then segmented for_each
will simply be:

for_each(segments(seq), for_each);

(Strike 1 for object algorithms, Dave?)

Effectively, each segment is unrolled for us by the mechanism
that already exists in fusion!

I think this is cool! This is more elegant than I expected it to be.
I like it! No, I love it!

Regards,
--
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise