Undefined reference to static constexpr char[]

前端 未结 6 1629
甜味超标
甜味超标 2020-11-22 08:06

I want to have a static const char array in my class. GCC complained and told me I should use constexpr, although now it\'s telling me

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 08:42

    Isn't the more elegant solution be changing the char[] into:

    static constexpr char * baz = "quz";
    

    This way we can have the definition/declaration/initializer in 1 line of code.

提交回复
热议问题