26 Jan
2015
26 Jan
'15
9:49 p.m.
On Mon, Jan 26, 2015 at 10:42 PM, Peter Dimov
Beman Dawes wrote:
Perhaps an error checking policy could be added as a template parameter, with two supplied - one a nop, the other throwing an exception on overflow.
Given that in many, if not most, cases, the check is a no-op - when the value type and the bits match - it might instead make sense to make the methods conditionally noexcept when the bits are enough to store everything in range, and always throw on overflow otherwise.
Isn't overflow more like a logic error than a runtime error? An assert might make more sense. -- Olaf