Title
Incomplete valarray::operator[] specification in [valarray.access]
Status
nad editorial
Section
[valarray.access]
Submitter
Daniel Krügler

Created on 2007-08-27.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [valarray.access]:

-1- When applied to a constant array, the subscript operator returns a reference to the corresponding element of the array. When applied to a non-constant array, tThe subscript operator returns a reference to the corresponding element of the array.

-3- The expression &a[i+j] == &a[i] + j evaluates as true for all size_t i and size_t j such that i+j is less than the length of the non-constant array a.

-4- Likewise, the expression &a[i] != &b[j] evaluates as true for any two non-constant arrays a and b and for any size_t i and size_t j such that i is less than the length of a and j is less than the length of b. This property indicates an absence of aliasing and may be used to advantage by optimizing compilers.281)

-5- The reference returned by the subscript operator for an non-constant array is guaranteed to be valid until the member function resize(size_t, T) (26.5.2.7) is called for that array or until the lifetime of that array ends, whichever happens first.

Date: 2007-08-27.00:00:00

Since the return type of valarray's operator[] const overload has been changed to const T& as described in 389 several paragraphs of the section [valarray.access] are now incompletely specified, because many requirements and guarantees should now also apply to the const overload. Most notably, the address and reference guarantees should be extended to the const overload case.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3527
2007-08-27 00:00:00admincreate