|
segmented fusion - a-ha!: msg#00057parsers.spirit.devel
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: void for_each( join_view<First, Second> view, F f ) { for_each( view.first, f ); for_each( view.second, f ); } or, implemented generically, more like: // for_each for segmented sequences ... void for_each( SegmentedSequence & seq, f ) { detail::segmented_for_each( fusion::begin(seq) , fusion::end(seq) , f, mpl::false_()); } where detail::segmented_for_each looks like: void segmented_for_each( SBegin const &sbegin , SEnd const &send , F f, mpl::false_) { fusion::for_each( fusion::deref(sbegin) , f); fusion::segmented_for_each( fusion::next(seq) , send , f, result_of::equal_to< typename result_of::next<SBegin>::type , SEnd>()); } No new Fusion primimtives are need! And we can get better perf by doing loop unrolling in segmented_for_each. Much simpler. -- Eric Niebler Boost Consulting www.boost-consulting.com ------------------------------------------------------- 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> |
|---|---|---|
| Previous by Date: | Re: Fusion-ifying proto parse trees: 00057, Eric Niebler |
|---|---|
| Next by Date: | Re: segmented fusion - a-ha!: 00057, Joel de Guzman |
| Previous by Thread: | further thoughts on adaptive parse algorithmsi: 00057, Tobias Schwinger |
| Next by Thread: | Re: segmented fusion - a-ha!: 00057, Joel de Guzman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |