Why isn't abs constexpr?

后端 未结 3 874
半阙折子戏
半阙折子戏 2020-12-16 13:39

In , since C++11, there are the following two overloads:

std::intmax_t abs( std::intmax_t n );
std::intmax_t imaxabs( std::intm         


        
3条回答
  •  粉色の甜心
    2020-12-16 14:03

    The simple explanation is probably that nobody went through every function listed as part of the standard library, and updated the entry to make it constexpr.

    Updating a standard is a process involving human effort to propose changes and get those proposals reviewed and accepted. And that means, when a new feature is added - and constexpr is a new feature - not everything else is automagically updated to use that feature. This particular case may well be updated in a future evolution of the standard - if some people take on the - often thankless - task of proposing the set of changes, some other people take on the task of reviewing it, and convincing those with voting power on the committee to accept it.

提交回复
热议问题