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 it’s an undefined...
Using C++11, Ubuntu 14.04, GCC default toolchain. This code fails: constexpr std::string constString = "constString"; error: the type ‘const string {aka const std::basic_string}’ of constexpr variable ‘constString’ is not...
If I have a variable inside a function (say, a large array), does it make sense to declare it both static and constexpr? constexpr guarantees that the array is...
It seems to me that having a “function that always returns 5” is breaking or diluting the meaning of “calling a function”. There must be a reason, or a...
Is there a difference between the following definitions? const double PI = 3.141592653589793; constexpr double PI = 3.141592653589793; If not, which style is preferred in C++11? 5 Answers 5
What’s the difference between constexpr and const? When can I use only one of them? When can I use both and how should I choose one? 10 s 10...