On Thu, Nov 20, 2014 at 5:20 AM, Olaf van der Spek
On Thu, Nov 20, 2014 at 11:00 AM, Andrzej Krzemienski
wrote: Note that the proposed expected
has the same "identity crisis": It'll probably face the same resistance. Comparing no value and a value simply doesn't make sense and code like shown is a real bug.
I disagree with this statement. In case of optional<T> having no value of T is deliberately treated as a yet another value. This has a well defined purpose. It is covered in the documentation here: http://www.boost.org/doc/libs/1_57_0/libs/optional/doc/html/boost_optional/q...
By containers you specifically mean map, right? Unordered map for example would not require operator<
Containers (maps) always come up as the primary rationale for operator< However, the user could also define his own comparison function for this purpose.
std::experimental::optional specializes std::less for exactly this purpose. It could retain this specialization while at the same time not support operator<. (Or, to save std::less, introduce std::order, but that is another conversation) Tony