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

前端 未结 7 778
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 23:50

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:49

    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.

提交回复
热议问题