When trying to get the value of a boost::optional object, BOOST_ASSERT is used to make sure the object is indeed initialized.
But what I would like when dereferencing an uninitialized optional is for an exception to be thrown - is there any way to get this behaviour in a release build? If not, is there any other similar library which has this behaviour?
I would hate to use the is_initialized method each time before dereferencing the object, and I'd also like to avoid wrapping the optional class in my own class to get this behaviour.
Thanks, Dan