[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/numeric/valarray/operator_arith2 [Back]  [Original]

std::valarray::operator+=,-=,*=,/=,%=,&=,|=,<<=,>>= cppreference.com
cppreference.com

std::valarray::operator+=,-=,*=,/=,%=,&=,|=,<<=,>>=

cppreference.com

<metanoindex/>

 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
(C++17)
(C++20)
(C++11)
(C++11)
(C++17)
(C++17)
(C++20)
(C++20)
(C++11)
(C++17)
(C++20)
(C++23)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
 
 
<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)
.
:
Applies compound assignment operators to each element in the numeric array.
Google.
. .
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.
Google.
. .
, size() != v.size()
:
The behavior is undefined if size() != v.size()
Google.
. .
, 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.
Google.
. .
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.
Google.
. .

v
:
another numeric array
Google.
. .
val
:
a value
Google.
. .

*this

()

:
:
Each of the operators can only be instantiated if the following requirements are met:
Google.
. .
  • T
    :
    The indicated operator can be applied to type T
    Google.
    . .
  • T (1-3) bool (4).
    :
    The result value can be unambiguously converted to T (1-3) or bool (4).
    Google.
    . .
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:
Google.
. .
  • const - std::valarray .
    :
    All const member functions of std::valarray are provided.
    Google.
    . .
  • std::valarray, std::slice_array, std::gslice_array, std::mask_array std::indirect_array .
    :
    std::valarray, std::slice_array, std::gslice_array, std::mask_array and std::indirect_array can be constructed from the replacement type.
    Google.
    . .
  • , const std::valarray& .
    :
    All functions accepting a arguments of type const std::valarray& should also accept the replacement type.
    Google.
    . .
  • const std::valarray& const std::valarray& .
    :
    All functions accepting two arguments of type const std::valarray& should accept every combination of const std::valarray& and the replacement type.
    Google.
    . .

Web Proxy Viewer  |  New URL  |  Original Page