17 Nov
2014
17 Nov
'14
7:29 a.m.
On Sun, 16 Nov 2014 23:04:43 -0800, Andrzej Krzemienski
Hi Everyone, I would like to run an idea through everyone in this list. There is a recurring complaint about Boost.Optional that it allows you to do "unsafe" things: 1. Inadvertent mixed comparisons between T and optional<T> 2. Unintended conversion from T to optional<T> 3. "Unchecked" access to the contained object, which causes an UB when performed on an uninitialized optional object.
Number 3 is really not an issue IMO. If you're going to overload operator* then existing C++ practice dictates that you have to do if(opt) before dereferencing opt, otherwise you'll have UB.