Why is std::numeric_limits<T>::max() a function?

这一生的挚爱 提交于 2019-11-28 10:42:31
Matthieu M.

To expand on Neil's remark, std::numeric_limit<T> 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!