Inside STL: The array -- Raymond Chen
The C++ standard library array is just a C-style array wrapped inside a class so that it behaves like a normal C++ object instead of a wacky thing that undergoes decay.
Inside STL: The array
By Raymond Chen
From the article:
template<typename T, size_t N> class array { T elements[N]; }; template<typename T> class array<T, 0> { };The only weird case is N = 0. You are allowed to create a zero-length
std::array, but C++ does not allow zero-length C-style arrays. The zero-lengthstd::arrayis just an empty class.Visual Studio and the Windows debugger come with a visualizer:
0:000> dx a a : { size=5 } [Type: std::array<int,5>] [<Raw View>] [Type: std::array<int,5>] [0] : 3 [Type: int] [1] : 1 [Type: int] [2] : 4 [Type: int] [3] : 1 [Type: int] [4] : 5 [Type: int]

People often say constexpr all the things. Andreas Fertig shows where we can use dynamic memory at compile time.

From dynamic container operations to compile-time constants, C++ offers a variety of techniques. In this article, we’ll delve into advanced initialization methods like
The C++ standard library type