
10 Jul
2008
10 Jul
'08
1:36 a.m.
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