##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::valarray::operator=

From cppreference.com
< cpp‎ | numeric‎ | valarray

valarray<T>& operator=( const valarray<T>& other ); | (1) |
valarray<T>& operator=( valarray<T>&& other ); | (2) | (since C++11)
valarray<T>& operator=( const T& val ); | (3) |
valarray<T>& operator=( const std::slice_array& ); | (4) |
valarray<T>& operator=( const std::gslice_array& ); | (5) |
valarray<T>& operator=( const std::mask_array& ); | (6) |
valarray<T>& operator=( const std::indirect_array& ); | (7) |
valarray<T>& operator=( std::initializer_list<T> il ); | (8) | (since C++11)

Replaces the contents of the numeric array.

1) Copy assignment operator. Replaces the contents with a copy of the contents of other.
2) Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this numeric array). `other` is in valid, but unspecified state afterwards.
3) Assigns each value in the numeric array the value of `val`.

| This section is incomplete

8) Assigns the contents of initializer list `il`. Equivalent to {{{1}}}.

### [edit] Parameters

other | - | another numeric array to assign
val | - | the value to initialize each element with
| This section is incomplete
il | - | initializer list to assign

### [edit] Return value

*this

### [edit] Exceptions

1) (none)
2)

(none) | (until C++11)
`noexcept` specification: noexcept | (since C++11)

3-8) (none)
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/valarray/operator%3D&oldid=64878"
Category:

- Todo without reason