c++ - Using mpl::vector to define boost::variant types -
i'm using library boost::variant
store large number of types. number of type growing, reach limit of 20 types. in documentation seems possible define variant using mpl::vector
, allows more 20 types (up 50 if i'm correct). tried replace variant definition this:
#include <boost/variant.hpp> #include <boost/mpl/vector.hpp> typedef boost::mpl::vector< float, math::float2, math::float3, relative_point<1>, relative_point<2>, relative_point<3>, std::string, color, group, dictionnary, reference, line, strip, text, font > variant_mpl_vec; typedef boost::make_variant_over<variant_mpl_vec>::type data_type; // old definition /*typedef boost::variant< float, math::float2, math::float3, relative_point<1>, relative_point<2>, relative_point<3>, std::string, color, group, dictionnary, reference, line, strip, text, font > data_type;*/
i'm putting directly code. of types structures containing few data.
when compiling, got strange:
error: no matching function call ‘boost::detail::variant::make_initializer_node::apply<boost::mpl::pair< ... , lots more ...
previous variant definition working fine, i'm surprised replacement doesn't work. i'm new mpl
maybe i'm missing - can't find ! am'i doing ?
thanks in advance.
variant type definition correct, problem due generic function in program taking arbitrary variant parameter. indeed, make_variant_over<mpl::vector<t0, t1, ...>>
behaves variant<t0, t1, ...>
not same type: variant<over_sequence<vector<t0, t1, ...>>>
(so t0 corresponds over_sequence<vector<t0, t1, ...>>
.
Comments
Post a Comment