Boost logo

Boost Users :

Subject: Re: [Boost-users] Variant and Fusion
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-10 16:46:30


AMDG

Matthias Vallentin wrote:
> there used to be a variant adapter for fusion sequences, but it has
> been rightfully removed:
>
> on Wed Dec 19 2007, Joel de Guzman <joel-AT-boost-consulting.com> wrote:
>
>> I intend to remove the variant adapter from fusion. After thorough
>> investigation, I think now that the move to make variant a
>> fusion sequence is rather quirky. A variant will always
>> have a size==1 regardless of the number of types it can contain
>> and there's no way to know at compile time what it contains.
>> Iterating over its types is simply wrong. All these imply that
>> the variant is *not* a fusion sequence.
>>
>
> Let's say I have a recursive variant and would like to flatten the
> variant to create some sort of heterogeneous sequence from it.
> Particularly, I would like to chop the variant into multiple disjunct
> Fusion sequences, each of which are handed to generic component that
> operates with Fusion sequences. The above suggests that Fusion is not
> the right tool. What would be a better approach to handle this problem?
>
> Should I split the variant into smaller variants instead? What made
> Fusion so attractive is the notion of tiers, i.e., light-weight views of
> references to the actual data. Is there a variant equivalent of tiers?
>

I'm not sure that I really understand what
you want. Can you give an example of the kind
of recursive variant and the sequence(s) that you
want to get out of it? In particular how are the
runtime values of the elements of the sequence
to be determined?

Depending on what you're doing, you might
be able to use the nested types typedef of
variant, which is an MPL sequence.

In Christ,
Steven Watanabe


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