Use of constexpr function before definition fails

后端 未结 2 603
[愿得一人]
[愿得一人] 2020-12-16 10:53

I\'m having some trouble with constexpr. The book C++ Primer shows a line of code:

  constexpr int sz = size(); // only size() is a con         


        
2条回答
  •  囚心锁ツ
    2020-12-16 11:19

    A constant expression function must be defined before its first use. See this paper, end of section 4.1.

提交回复
热议问题