I would like to define inside a class a constant which value is the maximum possible int. Something like this:
class A
{
...
static const int ERROR_V
It doesn't contradict, because max
is not defined static const
. It's just a static member function. Functions can't be const, and static member functions can't have a const attached at the very right either.
There is also a double max()
in the double version of the limits, and in C++03 it wouldn't work to say static double const max = ...
. So to be consistent, max()
is a function for all versions of the limit template.
Now, it's known that max()
not being able to be used like that is bad, and C++0x already solves it by making it a constexpr
function, allowing your proposed usage.