1.4 KiB
1.4 KiB
[indirect.array.assign]
29 Numerics library [numerics]
29.6 Numeric arrays [numarray]
29.6.9 Class template indirect_array [template.indirect.array]
29.6.9.2 Assignment [indirect.array.assign]
void operator=(const valarray<T>&) const; const indirect_array& operator=(const indirect_array&) const;
These assignment operators have reference semantics, assigning the values of the argument array elements to selected elements of thevalarray object to which it refers.
If theindirect_array specifies an element in thevalarray object to which it refers more than once, the behavior is undefined.
[Example 1:
int addr[] = {2, 3, 1, 4, 4}; valarray<size_t> indirect(addr, 5); valarray a(0., 10), b(1., 5); a[indirect] = b; results in undefined behavior since element 4 is specified twice in the indirection.
â end example]