Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-11-04 19:45:23

David Abrahams wrote:
> Eric Friedman <ebf_at_[hidden]> writes:
>>The question now: what should we call variant< type-seq >?
> Hm? If you're agreeing with me as you appear to be, it's just
> variant< type-seq >.

OK, I need to be clearer.

Assuming I agree with you (and I think I now do), then a variant
containing a value of type 'seq' itself will be written as:

   variant< seq >

However, in the case that 'seq' is an MPL sequence, then this is the
current syntax for variant whose bounded types are the elements of seq.

So to clarify: If we abandon the current syntax, what is the most
convenient replacement syntax that would allow the user to specify the
bounded types of a variant via a type sequence?

Potential ideas already proposed include:

  * variant< variant_types<some-mpl-type-sequence> >
  * variant_from_sequence<mpl-seq>::type

Both of these would work, of course. What I am looking for now is a more
convenient way to spell it.

One idea I've had:

   mpl::make_variant< mpl-seq >::type

Ideas welcome.


P.S. If variant itself becomes an MPL sequence at some future point, the
following elegant (if inefficient) syntax would become possible:

     , variant<>
     , mpl::push_front<_,_>

Boost list run by bdawes at, gregod at, cpdaniel at, john at