Why is std::numeric_limits::max() a function?

前端 未结 1 1658
悲&欢浪女
悲&欢浪女 2020-12-09 15:05

In the C++ Standard Library the value std::numeric_limits::max() is specified as a function. Further properties of a specific type are

1条回答
  •  臣服心动
    2020-12-09 16:02

    To expand on Neil's remark, std::numeric_limit is available for any number type including floating point numbers, and if you dig through the comp.lang.c++ thread, you'll see the mention that it might not be possible to define the static variables for floating point values.

    So, for consistency they decided to put both integral and floating points behind methods.

    It will change with C++0x, so there's hope.

    0 讨论(0)
提交回复
热议问题