Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2008-07-09 21:36:02


Robert Kawulak wrote:
> Hi,
>
>> From: utku
>>
>> can we create a saturating int with only lower bound set and
>> upper bound is infinite, like
>>
>> saturating_int<int, 1>::type ImageBoundary;
>
> Yes, you can simply write:
>
> saturating_int<int, 1, boost::integer_traits<int>::const_max>::type
> ImageBoundary;
>
> Since no int is greater than const_max, the upper bound will never be used for
> saturation (and I bet compilers will easily optimise the code eliminating the
> comparison with the upper bound).

    Would it be possible for you to make that a default parameter for
the class? That would really improve usability for this use-case.

Joe Gottman


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