Hi Eric,
2013/10/24 Eric Niebler
On 10/23/2013 7:30 AM, TONGARI J wrote:
Hi there,
I've created the ticket, doc&test included https://svn.boost.org/trac/boost/ticket/9294
'flatten' is an algorithm which returns a view that allows you to go through the leaf elems sequentially.
For example:
flatten(make_vector(1, make_vector(2, 3))) == make_vector(1, 2, 3)
This is developed when I use Fusion to work with SQL for simple data mapping.
You have duplicated a *huge* amount of work already in Fusion for supporting segmented sequences. If your Fusion sequence is logically a sequence of sequences, you just have to implement extension::is_segmented_impl and extension::segments_impl to make your type a valid Fusion sequence that has "flat" Fusion iterators. extension::segments_impl just has to return a Fusion sequence of Fusion sequences. See libs/fusion/test/sequence/tree.hpp for an example.
Sorry this isn't documented. That's my fault. I'm doubly sorry that you went to the trouble of implementing this. Adding support to Fusion for segmented sequences is one of the reasons why I have no hair today. ;-)
I just tried to re-implement it by segments_impl, but seems to cause memory violation. Code is attached. Could you shed some light on this? (note: flatten_view should be writable if the underlying sequence is writable) Thanks,