This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

188. valarray helpers missing augmented assignment operators

Section: 28.6.2.7 [valarray.cassign] Status: NAD Submitter: Gabriel Dos Reis Opened: 1999-08-15 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [valarray.cassign].

View all issues with NAD status.

Discussion:

26.5.2.6 defines augmented assignment operators valarray<T>::op=(const T&), but fails to provide corresponding versions for the helper classes. Thus making the following illegal:

#include <valarray>

int main()
{
std::valarray<double> v(3.14, 1999);

v[99] *= 2.0; // Ok

std::slice s(0, 50, 2);

v[s] *= 2.0; // ERROR
}

I can't understand the intent of that omission. It makes the valarray library less intuitive and less useful.

Rationale:

Although perhaps an unfortunate design decision, the omission is not a defect in the current standard.  A future standard may wish to add the missing operators.