I'm trying to understand this piece of C++ code from a text book:
template<typename T, int N>
struct Buffer {
using value_type = T;
constexpr int size() { return N; }
T[N];
// ...
};
It demonstrates stack allocation of the T[N]
array, but the array is not named. Later in the text this declaration is made:
Buffer<int,10> buf;
but it's not clear how to access the array buried inside this struct. Does the //...
have to include some accessors or is there some implicit facility of the language that can be used to get at the ints[10]
that live within buf?