This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.
717. Incompletevalarray::operator[]
specification in [valarray.access]
Section: 29.6.2.4 [valarray.access] Status: NAD Editorial Submitter: Daniel Krügler Opened: 2007-08-27 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [valarray.access].
View all issues with NAD Editorial status.
Discussion:
Since the return type of valarray
's operator[] const
overload has been changed to const T&
as described in 389(i) several paragraphs of the section 29.6.2.4 [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.
Proposed resolution:
Change 29.6.2.4 [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, t The subscript operator returns a reference to the corresponding element of the array.
-3- The expression
&a[i+j] == &a[i] + j
evaluates astrue
for allsize_t i
andsize_t j
such thati+j
is less than the length of the non-constant arraya
.-4- Likewise, the expression
&a[i] != &b[j]
evaluates astrue
for any two non-constant arraysa
andb
and for anysize_t i
andsize_t j
such thati
is less than the length ofa
andj
is less than the length ofb
. 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 a n 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4