C++11: Correct std::array initialization?

This is the bare implementation of std::array:

template<typename T, std::size_t N>
struct array {
    T __array_impl[N];
};

It’s an aggregate struct whose only data member is a traditional array, such that the inner {} is used to initialize the inner array.

Brace elision is allowed in certain cases with aggregate initialization (but usually not recommended) and so only one brace can be used in this case. See here: C++ vector of arrays

Leave a Comment