string::operator=
Assignment operators.
Synopsis
Description
-
(1), (4) 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 an element-wise copy of null-terminated string
s
.
After (2), the moved-from array behaves as if newly constructed with its current storage pointer.
Complexity
-
(1), (4) linear in
other.size()
. -
(2) constant if
*storage() == *other.storage()
; otherwise linear inother.size()
. -
(3) linear in
std::strlen(s)
.
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 string to copy. |
|
The null-terminated character string. |
Exceptions
Type | Thrown On |
---|---|
|
|
|
|