array::operator=
Assignment operators.
Synopsis
Description
Replaces the contents of the array.
-
(1) the contents are replaced with an element-wise copy of
other. -
(2) takes ownership of
other's element storage if*storage() == *other.storage(); otherwise equivalent to (1). -
(3) the contents are replaced with a copy of the values in
init.
After (2), the moved-from array behaves as if newly constructed with its current storage pointer.
Complexity
-
(1) linear in
size() + other.size(). -
(2) constant if
*storage() == *other.storage(); otherwise linear insize() + other.size(). -
(1) linear in
size() + init.size().
Exception Safety
(2) provides strong guarantee if *storage() != *other.storage() and no-throw guarantee otherwise. Other overloads provide strong guarantee. Calls to memory_resource::allocate may throw.
Return Value
*this
Parameters
| Name | Description |
|---|---|
|
The array to copy. |
|
The initializer list to copy. |