
3 Dec
2008
3 Dec
'08
9:34 a.m.
Jeff Garland wrote:
bounded_int
::type hour; hour = 20; // OK hour = 26; // exception! Behavior in case of assignment of an invalid value can be customized.
I think this is wrong.
Providing an invalid value should be a non-recoverable programming error.
Non-recoverable means it should abort the program, and programming error
means it should only be enabled in debug mode.
i.e. an assert is the best choice to assert the preconditions are met.
Apart from that, wouldn't it be more interestin, when multiplying a
bounded_int