std::indirect<T, Allocator>:: operator=
|
constexpr
indirect
&
operator
=
(
const
indirect
&
other
)
;
|
(1) | (since C++26) |
|
constexpr
indirect
&
operator
=
(
indirect
&&
other
)
noexcept
(
/* see below */
)
;
|
(2) | (since C++26) |
|
template
<
class
U
=
T
>
constexpr indirect & operator = ( U && value ) ; |
(3) | (since C++26) |
Replaces contents of * this with value or the contents of other .
Let
traits
be
std::
allocator_traits
<
Allocator
>
:
- If other is valueless, * this becomes valueless and the object owned by * this (if any) is destroyed using traits :: destroy and then the storage is deallocated.
-
Otherwise, if
alloc== other.allocis true and * this is not valueless, equivalent to ** this = * other . - Otherwise:
-
-
Constructs a new owned object in
*
this
using
traits
::
construct
with
*
other
as the argument, using the allocator
update_alloc
?
other.
alloc:alloc. - The previously owned object in * this (if any) is destroyed using traits :: destroy and then the storage is deallocated.
-
ppoints to the new owned object.
-
Constructs a new owned object in
*
this
using
traits
::
construct
with
*
other
as the argument, using the allocator
update_alloc
?
other.
alloc
is replaced with a copy of
other.
alloc
.
- If other is valueless, * this becomes valueless and the object owned by * this (if any) is destroyed using traits :: destroy and then the storage is deallocated.
-
Otherwise, if
alloc== other.allocis true , swaps the owned objects in * this and other ; the owned object in other (if any) is then destroyed using traits :: destroy and then the storage is deallocated. - Otherwise:
-
-
Constructs a new owned object in
*
this
using
traits
::
construct
with
std
::
move
(
*
other
)
as the argument, using the allocator
update_alloc
?
other.
alloc:alloc. - The previously owned object in * this (if any) is destroyed using traits :: destroy and then the storage is deallocated.
-
ppoints to the new owned object.
-
Constructs a new owned object in
*
this
using
traits
::
construct
with
std
::
move
(
*
other
)
as the argument, using the allocator
update_alloc
?
other.
alloc
is replaced with a copy of
other.
alloc
.
alloc
. Otherwise, equivalent to
**
this
=
std::
forward
<
U
>
(
value
)
.
- std:: is_same_v < std:: remove_cvref_t < U > , std :: indirect > is false .
- std:: is_constructible_v < T, U > is true .
- std:: is_assignable_v < T & , U > is true .
Contents |
Parameters
| other | - |
another
indirect
object whose owned value (if exists) is used for assignment
|
| value | - | value to assign to or construct the owned value |
Return value
* this
Exceptions
T
’s selected copy constructor, no effect.
T
’s copy assignment operator, the state of
this
-
>
p
is as defined by the exception safety guarantee of
T
’s copy assignment operator.
propagate_on_container_move_assignment
::
value
Example
|
This section is incomplete
Reason: no example |