| Home | Libraries | People | FAQ | More

###### value::operator= (22 of 24 overloads)

Assignment.

###### Synopsis

    value&
    operator=(
        array&& arr);

###### Description

The contents of the value are replaced with the contents of `arr` using move semantics:

- If `*arr.storage() == *this->storage()`, ownership of the underlying memory is transferred in constant time, with no possibility of exceptions. After assignment, the moved-from array becomes empty with its current storage pointer.
- If `*arr.storage() != *this->storage()`, an element-wise copy is performed, which may throw. In this case, the moved-from array is not changed.

###### Complexity

Constant, or linear in the size of `*this` plus `arr.size()`.

###### Exception Safety

Strong guarantee. Calls to `memory_resource::allocate` may throw.

###### Parameters

Name | Description
--- | ---
`arr` | The array to move-assign from.