2017-03-11 20:22 GMT+03:00 Robert Ramey via Boost
On 3/11/17 7:52 AM, Steven Watanabe via Boost wrote:
AMDG
On 03/11/2017 02:00 AM, Antony Polukhin via Boost wrote:
I'd like to see an additional statefull ExceptionPolicy that remembers that an UB was triggered, but does not throw at all. Here's how it could be used:
This also requires an extra function to combine two ExceptionPolicies for binary operators. You'll run into problems with comparison operators, though, as a bool can't hold an ExceptionPolicy.
Couldn't the addressed by a variation of the "ignore exception" policy which is meant to just return?
A simple extension to log such errors could be crafted from this idea and would make a great example on how to make one's own exception policy.
What is missing from this idea?
State of the Policy is missing. In many cases it could be useful to
have a Policy with state to be able to get the UB info. This may be
useful for different try_* functions that must not throw, usually are
in hot path and rarely trigger UB:
bool try_do(int x_native) noexcept {
bool was_an_error = false;
safe