Assignment operators

Synopses

Declared in <bslstl_sharedptr.h>

Copy‐assign from a compatible shared_ptr rhs.

shared_ptr&
operator=(shared_ptr const& rhs) noexcept;

Assign from a compatible shared_ptr rhs.

template<class COMPATIBLE_TYPE>
shared_ptr&
operator=(shared_ptr<COMPATIBLE_TYPE> const& rhs) noexcept
requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value;

Assign from a compatible shared_ptr rhs.

template<class COMPATIBLE_TYPE>
shared_ptr&
operator=(shared_ptr<COMPATIBLE_TYPE>&& rhs) noexcept
requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value;

Move‐assign from a compatible shared_ptr rhs.

Assign from a managed pointer, taking ownership of rhs.

template<class COMPATIBLE_TYPE>
shared_ptr&
operator=(BloombergLP::bslma::ManagedPtr<COMPATIBLE_TYPE> rhs)
requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value;

Assign from an auto pointer, taking ownership of rhs.

template<class COMPATIBLE_TYPE>
shared_ptr&
operator=(std::auto_ptr<COMPATIBLE_TYPE> rhs)
requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value;

Assign from a unique pointer, taking ownership of rhs.

template<
    class COMPATIBLE_TYPE,
    class UNIQUE_DELETER>
shared_ptr&
operator=(std::unique_ptr<COMPATIBLE_TYPE, UNIQUE_DELETER>&& rhs)
requires is_convertible<
            typename std::unique_ptr<COMPATIBLE_TYPE, UNIQUE_DELETER>::pointer,
                                     ELEMENT_TYPE *>::value;

Return Value

reference providing modifiable access to this shared pointer

Parameters

Name

Description

rhs

right‐hand side operand

Created with MrDocs