Technically, it's neither a struct nor a class -- it's a template.
std::array
is required to be an aggregate
. To make a long story short, this ends up meaning that it can't have anything private -- so it might as well be written as a struct
(which defaults to making everything public) instead of a class
, (which defaults to making everything private).
If you wanted to you could write it as a class
anyway:
template <...>
class array {
public:
// ...
But you need to make everything public anyway, so you might as well use a struct
that does that by default.