
Hi, i'm new here and i hope you can help me. My problem i have a class with a Boost Variant type as member and a implicit convert operator from my class to this Variant type. But when i want use the conversion in my programm the Compiler give me a error. Compiler Version gcc 4.4.1 on Ubuntu system Boost version 1.45 Example Program: #include <iostream> #include <boost/variant.hpp> #include <boost/lexical_cast.hpp> using namespace std; typedef boost::variant<float,int> Testtyp; class Testtypcontainer { public: Testtypcontainer():m_testtyp((float) 5.5){} Testtyp m_testtyp; template<class T> void settesttyp(T testvalue){m_testtyp =testvalue;} Testtyp gettesttyp(){return m_testtyp;} operator Testtyp() const{ return m_testtyp; } }; int main(){ Testtyp help1; Testtypcontainer help3; cout<<help3.gettesttyp()<<endl; help1=(Testtyp)help3; // generate compile error return 0; } P.s. Sorry for my bad english