2018-01-16 16:39 GMT+01:00 Andrey Semashev via Boost
On 01/16/18 18:35, Andrzej Krzemienski via Boost wrote:
How about annotating the conditional conversion to bool deprecated? It still compiles and works as before, but with compiler flag `-Werror=deprecated` can be turned into compiler error on demand, and then you are forced to rewrite to either:
``` if (ec.value() != 0) ```
This is not correct if we're going to accept Niall's proposal.
Correct. This is an alternative rather than complement to Niall's proposal.
or:
``` if (ec.failure()) ```
?
I really don't see the point of this.
This attempts to make everyone happy. You can still use the old syntax (conversion to bool) with old semantics. Others can request the compiler to look for potentially buggy usages of conversion operator. There is a way to check fast for zero-code (regardless if it means failure of success -- and you state your intentions explicitly) and we get function `failure()` that explicitly says you want to check for failure condition even at the expense of a virtual function call. Regards, &rzej;