
3 May
2010
3 May
'10
11 p.m.
On 3 May 2010 14:04, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
if (numeric_limits<T>::is_bounded) { // do something using max() and min() }
That wouldn't even compile if definitions of max and min weren't provided, even though it's perfectly legal and useful.
It will also give compiler warnings in certain compilers about branching on a constant. Generally the "correct" way is to only compile the max- or min-using code if is_bounded is true, by enable_if, specialization, or some other mechanism.