[valarray.cassign] # 29 Numerics library [[numerics]](./#numerics) ## 29.6 Numeric arrays [[numarray]](numarray#valarray.cassign) ### 29.6.2 Class template valarray [[template.valarray]](template.valarray#valarray.cassign) #### 29.6.2.7 Compound assignment [valarray.cassign] [🔗](#lib:operator*=,valarray) `valarray& operator*= (const valarray& v); valarray& operator/= (const valarray& v); valarray& operator%= (const valarray& v); valarray& operator+= (const valarray& v); valarray& operator-= (const valarray& v); valarray& operator^= (const valarray& v); valarray& operator&= (const valarray& v); valarray& operator|= (const valarray& v); valarray& operator<<=(const valarray& v); valarray& operator>>=(const valarray& v); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7853) *Mandates*: The indicated operator can be applied to two operands of type T[.](#1.sentence-1) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7857) *Preconditions*: size() == v.size() is true[.](#2.sentence-1) The value of an element in the left-hand side of a valarray compound assignment operator does not depend on the value of another element in that left hand side[.](#2.sentence-2) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7865) *Effects*: Each of these operators performs the indicated operation on each of the elements of *this and the corresponding element of v[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7871) *Returns*: *this[.](#4.sentence-1) [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7875) *Remarks*: The appearance of an array on the left-hand side of a compound assignment does not invalidate references or pointers[.](#5.sentence-1) [🔗](#lib:operator*=,valarray_) `valarray& operator*= (const T& v); valarray& operator/= (const T& v); valarray& operator%= (const T& v); valarray& operator+= (const T& v); valarray& operator-= (const T& v); valarray& operator^= (const T& v); valarray& operator&= (const T& v); valarray& operator|= (const T& v); valarray& operator<<=(const T& v); valarray& operator>>=(const T& v); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7905) *Mandates*: The indicated operator can be applied to two operands of type T[.](#6.sentence-1) [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7909) *Effects*: Each of these operators applies the indicated operation to each element of *this and v[.](#7.sentence-1) [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7914) *Returns*: *this[.](#8.sentence-1) [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L7918) *Remarks*: The appearance of an array on the left-hand side of a compound assignment does not invalidate references or pointers to the elements of the array[.](#9.sentence-1)