Boost logo

Boost :

Subject: Re: [boost] safe integer library -- the scope
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-12-11 20:45:31


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;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk