I have a type that derives from boost::variant<T, E>
. I do the following, and I cannot use the copy constructor, I cannot figure out why, some SFINAE
seems to fail. Looks that the boost::variant<T, E>
construction is swallowing a T
as ExpectedResult<T, E>
in the inherited constructor. How could I fix it to make it work and with the simplest solution?
template <class T, class E>
class ExpectedResult : boost::variant<T, E> {
public:
using boost::variant<T, E>::variant;
};
ExpectedResult<int,float> er;
ExpectedResult<int, float> er2 = er;
error: no type named 'type' in 'boost::enable_if<boost::mpl::and_<boost::mpl::not_<boost::is_same<Emotiv::Cortex::Utilities::ExpectedResult<int, float>, boost::variant<int, float> > >, boost::detail::variant::is_variant_constructible_from<const Emotiv::Cortex::Utilities::ExpectedResult<int, float> &, boost::mpl::l_item<mpl_::long_<2>, int, boost::mpl::l_item<mpl_::long_<1>, float, boost::mpl::l_end> > >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >, void>'; 'enable_if' cannot be used to disable this declaration
typename boost::enable_if<mpl::and_<
^~~~~~~~~~
note: in instantiation of member function 'boost::variant<int, float>::variant' requested here
using boost::variant<T, E>::variant;
while substituting deduced template arguments into function template 'ExpectedResult' [with T = Emotiv::Cortex::Utilities::ExpectedResult<int, float>]
ExpectedResult<int, float> er2 = er;
Aucun commentaire:
Enregistrer un commentaire