Boost logo

Boost Users :

Subject: Re: [Boost-users] Variant and Fusion
From: Matthias Vallentin (vallentin_at_[hidden])
Date: 2010-03-11 02:14:30


On Wed, Mar 10, 2010 at 05:25:02PM -0800, Steven Watanabe wrote:
> You have to know the type of the vector at compile time.

Even if I know the type of the vector at compile time, how could I
create the fusion vector incrementally from the variant? Since push_back
always returns a new type, I don't know how to do this with a visitor.

> >I was also talking about "chopping" the variant in disjunct sequences.
> >By this, I mean that a visitor goes over the variant and creates several
> >sequences, say
> >
> > [42]
> > [4.2, 42]
> > [42]
>
> I think the easiest way is probably to create a runtime
> iterator that walks over the vector and recurses into
> any variants that it contains.
>
> Then you can use fusion's
> algorithms to iterate over the fusion::vector and the
> vector in parallel.

I'm not sure if I can follow. If I start with the variant and have some
plan to partition it into sequences, how would I use an iterator rather
a visitor? Would you mind illustrating your idea with a small code
snippet?

   Matthias

-- 
Matthias Vallentin
vallentin_at_[hidden]
http://www.icir.org/matthias

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net