How to workaround the inconsistent definition of numeric_limits::min()?

前端 未结 7 1376
予麋鹿
予麋鹿 2021-02-08 00:05

The numeric_limits traits is supposed to be a general way of obtaining various type infomation, to be able to do things like

template
T min(con         


        
7条回答
  •  灰色年华
    2021-02-08 00:28

    This is an old thread, but there is an updated answer:

    C++11 added a lowest() function to std::numeric_limits (See here)

    So you can now call std::numeric_limits::lowest() to get the lowest representable negative value.

提交回复
热议问题