26 Aug
2009
26 Aug
'09
4:12 a.m.
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; |
| 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