
30 Dec
2006
30 Dec
'06
11:09 p.m.
Hello, the following code fails using Boost 1.33.1, gcc version 3.4.2 (mingw-special): boost::optional<double> x; x=boost::optional<float>(boost::none); // converting assignment with the following error message: Assertion failed: this->is_initialized(), file ...boost/optional/optional.hpp, line 531 Replacing template<class U> optional& operator= ( optional<U> const& rhs ) { this->assign(rhs.get()); return *this ; } by e.g. template<class U> optional& operator= ( optional<U> const& rhs ) { if(rhs) this->assign(rhs.get()); else this->reset(); return *this ; } should fix the bug. Regards, Michael