Possible Duplicate:
Why is std::numeric_limits<T>::max() a function?
I was wondering if someone could explain the reasoning behind why std::numeric_limit<T>::min
and max
are functions and not constants?
Furthermore, I'd like to know what techniques can be used to make use of the min/max values as part of template parameters, eg:
template<unsigned long long max>
class foo
{
public:
void boo() { std::cout << max << std::endl; }
};
.
.
.
foo<std::numeric_limits<int>::max()> f;
f.boo();