Is it possible (and how) to recognize boost::variant
from which variant
type comes from?
For example, I have two (or more) variants:
boost::variant<MyType1, MyType2> variant1;
boost::variant<MyType3, MyType4> variant2;
I want to write template functions that can somehow choose proper variant to get value.
template <class T>
T foo(boost::variant<MyType1, MyType2> variant1, boost::variant<MyType3, MyType4> variant2)
{
return boost::get<T>(/*variant1 or variant2*/);
}
Is it possible?
Aucun commentaire:
Enregistrer un commentaire