
12 Dec
2015
12 Dec
'15
1:45 a.m.
On 12/11/15 5:15 PM, Robert Ramey wrote:
using safe_t = safe_integer_range<-100, 100, native, trap_exception>;
safe_t a, x, b, y; y = a * x + b;
at compile time it detected that the result falls in the range [-10100, 10100] and that this range is not included in the range [100, 100]. The trap_exception policy will invoke a static_assert.
Robert Ramey
whoops should be: using safe_t = safe_integer_range<-100, 100, native, trap_exception>; safe_t a, x, b, y; y = a * x + b;