On 25/05/2017 19:44, Vicente J. Botet Escriba wrote:
3. uninitialized default constructed expected
I've already stated my opinion on this elsewhere.
Outcome doesn't implement comparisons between Outcomes. He pretend that we don't need them. In addition the mix of comparisons and implicit conversion give us some surprising cases as described in Andrzej blog.
I agree with Niall -- putting one directly in an ordered collection is bizarre and if someone really wants to do that then it should be left up to them to define what ordering makes sense to them. operator< should absolutely not be implemented and I would hesitate before providing any free standard ordering methods.
The implicit conversion from T to expected
is a consequence of wanting that expected should behave like a T. But this is not right. A expected is not a T.
Implicit construction does not imply is-a, it implies is-superset-of.
Which is true, expected
My question is why don't throw directly E?
Some are requesting a way to get a specific exception from E, but either there is one exception that works for all and we can set it using some kind of trait or we need to add a trait parameter to expected to the the mapping :(
Do we really want this to be configurable?
At least where E happens to be std::error_code it would be nice if it threw std::system_error, since that is the exception designed for such things. Otherwise I have no opinion.