In order to initialize a std::array
with some values, you need to use this approach:
std::array<int,3> an_array3;
I am aware of the reason that we need two curly braces (one for std::array
and the the other for the inner c-style array
).
My question: Why, by standard, std::array
does not contain an initializer-list constructor that directly initialize the inner c-style array
? Is not more eyes-friendly to be initialized as:
std::array<int,3> an_array{3,4,5};
Aucun commentaire:
Enregistrer un commentaire