O
Old Wolf
In 12.6.1 of n2521, it says:
"When an aggregate (whether class or array) contains
members of class type and is initialized by a brace-
enclosed initializer list, each such member is
copy-initialized by the corresponding assignment-expression."
Then the example is given:
complex v[6] = { 1, complex(1,2), complex(), 2 };
where 'complex' is a small class defined in the 12.6
for exemplary purposes.
According to the above paragraph, v[1] should be
copy-constructed from the temporary complex(1,2).
However, the explanation of the example code says:
"complex::complex(double,double) is called for the
initialization of v[1]".
That is, it says that v[1] is directly constructed with
arguments 1,2, and no copy constructor is involved.
Is the example rationale wrong, or have I misinterpreted
the paragraph quoted above?
"When an aggregate (whether class or array) contains
members of class type and is initialized by a brace-
enclosed initializer list, each such member is
copy-initialized by the corresponding assignment-expression."
Then the example is given:
complex v[6] = { 1, complex(1,2), complex(), 2 };
where 'complex' is a small class defined in the 12.6
for exemplary purposes.
According to the above paragraph, v[1] should be
copy-constructed from the temporary complex(1,2).
However, the explanation of the example code says:
"complex::complex(double,double) is called for the
initialization of v[1]".
That is, it says that v[1] is directly constructed with
arguments 1,2, and no copy constructor is involved.
Is the example rationale wrong, or have I misinterpreted
the paragraph quoted above?