|
Boost : |
Subject: Re: [boost] [safe_numerics] One more review
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2017-03-11 17:51:28
On 2017-03-11 10:00, Antony Polukhin via Boost wrote:
> - What is your evaluation of the design?
>
> Looks good, simple to use.
>
> 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:
I would also vote for a class similar like that. However, i would move
the whole interface closer to expected in that case. e.g. I might want
to know what happened. Lets call this class checked<int>.
The behaviour should be like this: all operations between a checked<int>
and other integers should work independent of the state of the
checked<int> object. However the value of a checked<int> can only be
obtained using:
checked<int> myInt= ...
if(myInt){
int val = myInt.value();
}else if(myInt.error() == overflow){
//some error handling here
}else{
//some terminal error handling here
}
Best,
Oswin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk