I have a incomplete type
Struct A { char x; B b; }
Struct B { int x; A a; }
and a boost::variant containing an B element. There are three possibilitys to declare my variant:
typedef boost::variant<B, char, int> vari // this is wrong because of the incomplete type typedef boost::variant<B*, char, int> vari // this works
typedef boost::variant<B&, char, int> vari // this works also
but now i have the following funktion:
void setVari(vari& v){ int x; v = x; }
This function does only work if i use the second method to declare my variant. If i use the refrence contend, boost throws template argument deduction/substituition faild compiler errors.
Is there a possibility to make this function work, if i use a refrence instead of a pointer?
Aucun commentaire:
Enregistrer un commentaire