storage_ptr::operator=

Move assignment.

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 *this will be be non-owning.

  • If other has shared ownership, then ownership will be transferred to *this.

After assignment, other will point to the default memory resource. If *this previously had shared ownership, it is released before the function returns.

Complexity

Constant.

Exception Safety

No-throw guarantee.

Parameters

Name Description

other

The storage pointer to move.