Categories
arrays c++ c++11 constexpr

Can std::array be used in a constexpr class?

I am currently creating a class with a constexpr constructor and I wonder if I can use an std::array to store the data of this class. Does the standard explicitly specify that an std::array has a constexpr constructor and that its contents can be accessed at compile-time ?

Because std::array<T, N> is an aggregate, it can be initialized as a constexpr if and only if the underlying type T has a constexpr constructor (when presented with each initializer you provide).