Boost variant has a function called make_variant_over
that takes an MPL sequence (for example list<A, B, C>
) and produces a variant from those types.
However if one looks carefully the type generated is never a simple variant<A, B, C>
.
For example in this code,
#include<boost/variant.hpp>
int main(){
using List = boost::mpl::list<double, int>;
using Variant = boost::make_variant_over<List>::type;
}
Variant
is boost::variant<boost::detail::variant::over_sequence<boost::mpl::list<double, int, mpl_::na, ...> >>
.
It looks like it can be used interchangeability with boost::variant<double, int>
, but it is not the same type. At best that can generate confusion when reading compiler errors and at worst it can make difficult to implement certain functions that rely on the exact type of the argument.
Is there a way to force a simplification in the produced variant type?