Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][Variant] Sequence instantiation
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-08-26 00:12:01


AMDG

Ryan McConnehey wrote:
> I have a sequence of types defined with the Loki library. I believe
> the equivalent would be boost::mpl::vector. The sequence is used to
> cause compile time asserts for unsupported types being passed to
> template functions. Boost variant can be created with a given list of
> types.
>
> typedef boost::variant< int, std::string, short, long > type_list;
> | <boost/variant.html>|
> Is it possible to create a variant from a sequence by either passing
> the sequence or iterating through each value in the sequence? This
> would reduce the code duplication of having one sequence for assert
> checking and the other for variants.

Use the metafunction boost::make_variant_over.

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