storage_ptr::operator=
Assignment operators.
Synopsis
storage_ptr&
operator=(
storage_ptr&& other) noexcept; (1)
storage_ptr&
operator=(
storage_ptr const& other) noexcept; (2)
Description
This function assigns a pointer that points to the same memory resource as other
, with the same ownership:
-
If
other
is non-owning, then the assigned-to pointer will be be non-owning. -
If
other
has shared ownership, then (1) transfers ownership to the assigned-to pointer, while after (2) it shares the ownership withother
.
If the assigned-to pointer previously had shared ownership, it is released before the function returns.
After (1), other
will point to the default memory resource.
Complexity
Constant.
Exception Safety
No-throw guarantee.
Parameters
Name | Description |
---|---|
|
Another pointer. |