Title
Valarray and value-initialization
Status
nad editorial
Section
[valarray.cons]
Submitter
Alberto Ganesh Barbati

Created on 2008-07-20.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [valarray.cons], paragraph 2:

explicit  valarray(size_t);

The array created by this constructor has a length equal to the value of the argument. The elements of the array are constructed using the default constructor for the instantiating type T value-initialized ([dcl.init]).

Change [valarray.members], paragraph 9:

[Example: If the argument has the value -2, the first two elements of the result will be constructed using the default constructor value-initialized ([dcl.init]); the third element of the result will be assigned the value of the first element of the argument; etc. -- end example]

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to NAD Editorial.

Date: 2008-07-20.00:00:00

From [valarray.cons], paragraph 2:

explicit  valarray(size_t);

The array created by this constructor has a length equal to the value of the argument. The elements of the array are constructed using the default constructor for the instantiating type T.

The problem is that the most obvious Ts for valarray are float and double, they don't have a default constructor. I guess the intent is to value-initialize the elements, so I suggest replacing:

The elements of the array are constructed using the default constructor for the instantiating type T.

with

The elements of the array are value-initialized.

There is another reference to the default constructor of T in the non-normative note in paragraph 9. That reference should also be replaced. (The normative wording in paragraph 8 refers to T() and so it doesn't need changes).

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4124
2010-10-21 18:28:33adminsetmessages: + msg4123
2008-07-20 00:00:00admincreate