See the cppreference section in aggregate initialization .
Aggregate Initialization Effects:
Each element of the array or non-static member of the class in the index / appearance order of the array in the class definition is initialized by copying the corresponding section of the initializer list.
If the initializer clause is a nested list with a binding to completion, the corresponding class member is itself an aggregate: aggregate initialization is recursive.
This means that if you had your own population within your structure, for example:
struct str { struct asdf { int first, last; } asdf; };
asdf will be initialized with the first nested parenthesis initialization list, i.e. { { 1, 2 } } . The reason you usually need two pairs of curly braces is because the nested list of anchor elements initializes the base aggregate in std::array (for example, T a[N] ).
However, you can still initialize your array as follows:
array<str,3> fields { 1, 2, 3, 4, 5, 6 };
or
array<str,3> fields { { 1, 2, 3, 4, 5, 6 } };
instead of this.
On the other hand, how you initialize your vector is covered by list initialization . std::vector has a constructor that takes std::initializer_list .
Effects of initializing a list of an object of type T:
Please note that you cannot initialize your vector (for example:
vector<str> fields { 1,2, 3,4, 5,6 };
but
vector<int> fields { 1,2, 3,4, 5,6 };
fine.