Andrey Semashev-2 wrote
1. You chose not to provide relational operators for compact_optional because you don't know how to order 'empty' values. I think you don't have to make that decision and simply forward the call to the underlying type. I mean, you always have the stored object constructed in some state and as long as it implements operators you can always use them.
This is exactly the problem I sometimes have with Boost.Optional: in some use cases, I want the compiler to remind me that my special value is special and always has to be checked explicitly instead of assuming it's always the lowest possible value. That doesn't apply to operator== and operator!=, of course. Andrey Semashev-2 wrote
5. A suggestion: add evp_zero and evp_empty policies. The first uses literal zero as the special value and can be used with numeric (integer and fp) and pointer types. The second uses a default constructed value as the magic value and a member empty() function to test for magic value. This could be useful with containers, strings and ranges.
+1, evp_empy would also be useful for a lot of other custom classes I've seen. -- View this message in context: http://boost.2283326.n4.nabble.com/compact-optional-prompting-interest-tp468... Sent from the Boost - Dev mailing list archive at Nabble.com.