boost optional assignment
The following code gives me compilation error. With const reference it's
ok. Is it right behaviour?
#include
On Fri, Aug 17, 2012 at 4:35 AM, tolik levchik
The following code gives me compilation error. With const reference it's ok. Is it right behaviour?
Tolik, I've never tried to pass a mutable reference into an object's copy constructor (and furthermore I cannot imagine a reason to). Nevertheless, on my machine (boost 1.48, gcc 4.5.3) this works: // opt = *ptr; // error opt.reset(*ptr); // good I'm not sure why one works while the other doesn't as they both appear to be declared the same: optional& operator= ( argument_type val ) { this->assign( val ) ; return *this ; } void reset ( argument_type val ) { assign(val); } Chris
participants (2)
-
Chris Stankevitz
-
tolik levchik