std::valarray::operator+=,-=,*=,/=,%=,&=,|=,<<=,>>=
cppreference.com
[] |
Google. . , . , . |
<metanoindex/>
<tbody> </tbody> valarray<T> operator+=( const valarray<T>& v ); valarray<T> operator-=( const valarray<T>& v ); valarray<T> operator*=( const valarray<T>& v ); valarray<T> operator/=( const valarray<T>& v ); valarray<T> operator%=( const valarray<T>& v ); valarray<T> operator&=( const valarray<T>& v ); valarray<T> operator|=( const valarray<T>& v ); valarray<T> operator^=( const valarray<T>& v ); valarray<T> operator<<=( const valarray<T>& v ); valarray<T> operator>>=( const valarray<T>& v ); |
(1) | |
valarray<T> operator+=( const T& val ); valarray<T> operator-=( const T& val ); valarray<T> operator*=( const T& val ); valarray<T> operator/=( const T& val ); valarray<T> operator%=( const T& val ); valarray<T> operator&=( const T& val ); valarray<T> operator|=( const T& val ); valarray<T> operator^=( const T& val ); valarray<T> operator<<=( const T& val ); valarray<T> operator>>=( const T& val ); |
(2) | |
.
1)
,
v.:
Each element is assigned value obtained by applying the corresponding operator to the previous value of the element and corresponding element from
v. ,
size() != v.size() ,
v *this, .:
The behavior is undefined if any of the values in
v is computed during the assignment and depends on any of the values in *this, that is, the expression on the right side of the assignment refers to a variable in the left side of the assignment.2)
,
val.:
Each element is assigned value obtained by applying the corresponding operator to the previous value of the element and the value of
val.| v | ||
| val |
*this
()
:
TT(1-3)bool(4).
std::valarray. , :
:
The function can be implemented with the return type different from std::valarray. In this case, the replacement type has the following properties:
- std::valarray,
std::slice_array,std::gslice_array,std::mask_arraystd::indirect_array.:std::valarray,std::slice_array,std::gslice_array,std::mask_arrayandstd::indirect_arraycan be constructed from the replacement type. - ,
const std::valarray&.:All functions accepting a arguments of typeconst std::valarray&should also accept the replacement type. const std::valarray&const std::valarray&.:All functions accepting two arguments of typeconst std::valarray&should accept every combination ofconst std::valarray&and the replacement type.