Is the code fragment
struct Parameters {
static constexpr int n = 2;
static constexpr double v[n] = {4.0, 5.0};
};
legal C++11? And, if so, are Parameters::v[0]
and Parameters::v[1]
compile time constants or is just the pointer Parameters::v
itself a constexpr
(whatever that would mean at compile time)?
As you can see I am generally a bit confused about constexpr
arrays and their initialization in classes/structs. Please feel free to not only answer my specific question but also to mention common pitfalls and the like concerning this topic.