use of constexpr in header file

后端 未结 4 714
情话喂你
情话喂你 2021-01-31 09:06

I can have a definition like this in a header file?

 constexpr double PI=3.14;

Is there any problem in having this in a header file that would

4条回答
  •  滥情空心
    2021-01-31 09:42

    In C++17 you are clear. In C++11, you can wrap it in a function:

    constexpr double PI () { return 3.14; }
    

提交回复
热议问题