.TH "std::shared_ptr< _Tp >" 3cxx "Tue Jul 18 2023" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::shared_ptr< _Tp > \- A smart pointer with reference-counted copy semantics\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits std::__shared_ptr< _Tp, _Lp >\&. .SS "Public Types" .in +1c .ti -1c .RI "using \fBelement_type\fP = typename __shared_ptr< _Tp >::element_type" .br .RI "The type pointed to by the stored pointer, remove_extent_t<_Tp> " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "constexpr \fBshared_ptr\fP () noexcept" .br .RI "Construct an empty shared_ptr\&. " .ti -1c .RI "template> \fBshared_ptr\fP (_Yp *__p)" .br .RI "Construct a shared_ptr that owns the pointer \fI__p\fP\&. " .ti -1c .RI "template> \fBshared_ptr\fP (_Yp *__p, _Deleter __d)" .br .RI "Construct a shared_ptr that owns the pointer \fI__p\fP and the deleter \fI__d\fP\&. " .ti -1c .RI "template> \fBshared_ptr\fP (_Yp *__p, _Deleter __d, _Alloc __a)" .br .RI "Construct a shared_ptr that owns the pointer \fI__p\fP and the deleter \fI__d\fP\&. " .ti -1c .RI "\fBshared_ptr\fP (const \fBshared_ptr\fP &) noexcept=default" .br .RI "Copy constructor\&. " .ti -1c .RI "template&>> \fBshared_ptr\fP (const \fBshared_ptr\fP< _Yp > &__r) noexcept" .br .RI "If \fI__r\fP is empty, constructs an empty shared_ptr; otherwise construct a shared_ptr that shares ownership with \fI__r\fP\&. " .ti -1c .RI "template \fBshared_ptr\fP (const \fBshared_ptr\fP< _Yp > &__r, \fBelement_type\fP *__p) noexcept" .br .RI "Constructs a \fCshared_ptr\fP instance that stores \fC__p\fP and shares ownership with \fC__r\fP\&. " .ti -1c .RI "template&>> \fBshared_ptr\fP (const \fBweak_ptr\fP< _Yp > &__r)" .br .RI "Constructs a shared_ptr that shares ownership with \fI__r\fP and stores a copy of the pointer stored in \fI__r\fP\&. " .ti -1c .RI "template \fBshared_ptr\fP (nullptr_t __p, _Deleter __d)" .br .RI "Construct a shared_ptr that owns a null pointer and the deleter \fI__d\fP\&. " .ti -1c .RI "template \fBshared_ptr\fP (nullptr_t __p, _Deleter __d, _Alloc __a)" .br .RI "Construct a shared_ptr that owns a null pointer and the deleter \fI__d\fP\&. " .ti -1c .RI "constexpr \fBshared_ptr\fP (nullptr_t) noexcept" .br .RI "Construct an empty shared_ptr\&. " .ti -1c .RI "\fBshared_ptr\fP (\fBshared_ptr\fP &&__r) noexcept" .br .RI "Move-constructs a shared_ptr instance from \fI__r\fP\&. " .ti -1c .RI "template>> \fBshared_ptr\fP (\fBshared_ptr\fP< _Yp > &&__r) noexcept" .br .RI "Move-constructs a shared_ptr instance from \fI__r\fP\&. " .ti -1c .RI "template \fBshared_ptr\fP (\fBstd::auto_ptr\fP< _Tp1 > &&__r)" .br .ti -1c .RI "template>> \fBshared_ptr\fP (\fBunique_ptr\fP< _Yp, _Del > &&__r)" .br .ti -1c .RI "\fBelement_type\fP * \fBget\fP () const noexcept" .br .RI "Return the stored pointer\&. " .ti -1c .RI "\fBoperator bool\fP () const" .br .RI "Return true if the stored pointer is not null\&. " .ti -1c .RI "\fBelement_type\fP & \fBoperator*\fP () const noexcept" .br .ti -1c .RI "\fBelement_type\fP * \fBoperator\->\fP () const noexcept" .br .ti -1c .RI "\fBshared_ptr\fP & \fBoperator=\fP (const \fBshared_ptr\fP &) noexcept=default" .br .ti -1c .RI "template _Assignable< const \fBshared_ptr\fP< _Yp > & > \fBoperator=\fP (const \fBshared_ptr\fP< _Yp > &__r) noexcept" .br .ti -1c .RI "\fBshared_ptr\fP & \fBoperator=\fP (\fBshared_ptr\fP &&__r) noexcept" .br .ti -1c .RI "template _Assignable< \fBshared_ptr\fP< _Yp > > \fBoperator=\fP (\fBshared_ptr\fP< _Yp > &&__r) noexcept" .br .ti -1c .RI "template _Assignable< \fBunique_ptr\fP< _Yp, _Del > > \fBoperator=\fP (\fBunique_ptr\fP< _Yp, _Del > &&__r)" .br .ti -1c .RI "void \fBreset\fP () noexcept" .br .ti -1c .RI "template _SafeConv< _Yp > \fBreset\fP (_Yp *__p)" .br .ti -1c .RI "template _SafeConv< _Yp > \fBreset\fP (_Yp *__p, _Deleter __d)" .br .ti -1c .RI "template _SafeConv< _Yp > \fBreset\fP (_Yp *__p, _Deleter __d, _Alloc __a)" .br .ti -1c .RI "void \fBswap\fP (__shared_ptr< _Tp, _Lp > &__other) noexcept" .br .RI "Exchange both the owned pointer and the stored pointer\&. " .ti -1c .RI "bool \fBunique\fP () const noexcept" .br .RI "Return true if use_count() == 1\&. " .ti -1c .RI "long \fBuse_count\fP () const noexcept" .br .RI "If *this owns a pointer, return the number of owners, otherwise zero\&. " .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template bool \fBowner_before\fP (__shared_ptr< _Tp1, _Lp > const &__rhs) const noexcept" .br .RI "Define an ordering based on ownership\&. " .ti -1c .RI "template bool \fBowner_before\fP (__weak_ptr< _Tp1, _Lp > const &__rhs) const noexcept" .br .RI "Define an ordering based on ownership\&. " .in -1c .in -1c .SS "Friends" .in +1c .ti -1c .RI "template \fBshared_ptr\fP< _Yp > \fBallocate_shared\fP (const _Alloc &__a, _Args &&\&.\&.\&. __args)" .br .ti -1c .RI "class \fBweak_ptr< _Tp >\fP" .br .in -1c .SS "Related Functions" (Note that these are not member functions\&.) .in +1c .ti -1c .RI "template _Del * \fBget_deleter\fP (const \fBshared_ptr\fP< _Tp > &__p) noexcept" .br .RI "20\&.7\&.2\&.2\&.10 shared_ptr get_deleter " .ti -1c .RI "template \fBstd::basic_ostream\fP< _Ch, _Tr > & \fBoperator<<\fP (\fBstd::basic_ostream\fP< _Ch, _Tr > &__os, const __shared_ptr< _Tp, _Lp > &__p)" .br .RI "Write the stored pointer to an ostream\&. " .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template bool \fBoperator==\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .ti -1c .RI "template bool \fBoperator==\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator==\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator!=\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .RI "Inequality operator for shared_ptr objects, compares the stored pointers\&. " .ti -1c .RI "template bool \fBoperator!=\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator!=\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator<\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .RI "Relational operator for shared_ptr objects, compares the stored pointers\&. " .ti -1c .RI "template bool \fBoperator<\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator<\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator<=\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .RI "Relational operator for shared_ptr objects, compares the stored pointers\&. " .ti -1c .RI "template bool \fBoperator<=\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator<=\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator>\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .RI "Relational operator for shared_ptr objects, compares the stored pointers\&. " .ti -1c .RI "template bool \fBoperator>\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator>\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator>=\fP (const \fBshared_ptr\fP< _Tp > &__a, const \fBshared_ptr\fP< _Up > &__b) noexcept" .br .RI "Relational operator for shared_ptr objects, compares the stored pointers\&. " .ti -1c .RI "template bool \fBoperator>=\fP (const \fBshared_ptr\fP< _Tp > &__a, nullptr_t) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template bool \fBoperator>=\fP (nullptr_t, const \fBshared_ptr\fP< _Tp > &__a) noexcept" .br .RI "shared_ptr comparison with nullptr " .ti -1c .RI "template void \fBswap\fP (\fBshared_ptr\fP< _Tp > &__a, \fBshared_ptr\fP< _Tp > &__b) noexcept" .br .RI "Swap overload for shared_ptr\&. " .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBstatic_pointer_cast\fP (const \fBshared_ptr\fP< _Up > &__r) noexcept" .br .RI "Convert type of \fCshared_ptr\fP, via \fCstatic_cast\fP " .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBconst_pointer_cast\fP (const \fBshared_ptr\fP< _Up > &__r) noexcept" .br .RI "Convert type of \fCshared_ptr\fP, via \fCconst_cast\fP " .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBdynamic_pointer_cast\fP (const \fBshared_ptr\fP< _Up > &__r) noexcept" .br .RI "Convert type of \fCshared_ptr\fP, via \fCdynamic_cast\fP " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBallocate_shared\fP (const _Alloc &__a, _Args &&\&.\&.\&. __args)" .br .RI "Create an object that is owned by a shared_ptr\&. " .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBmake_shared\fP (_Args &&\&.\&.\&. __args)" .br .RI "Create an object that is owned by a shared_ptr\&. " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template bool \fBatomic_is_lock_free\fP (const __shared_ptr< _Tp, _Lp > *__p)" .br .RI "Report whether shared_ptr atomic operations are lock-free\&. " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBatomic_load_explicit\fP (const \fBshared_ptr\fP< _Tp > *__p, \fBmemory_order\fP)" .br .RI "Atomic load for shared_ptr objects\&. " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template void \fBatomic_store_explicit\fP (\fBshared_ptr\fP< _Tp > *__p, \fBshared_ptr\fP< _Tp > __r, \fBmemory_order\fP)" .br .RI "Atomic store for shared_ptr objects\&. " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template \fBshared_ptr\fP< _Tp > \fBatomic_exchange_explicit\fP (\fBshared_ptr\fP< _Tp > *__p, \fBshared_ptr\fP< _Tp > __r, \fBmemory_order\fP)" .br .RI "Atomic exchange for shared_ptr objects\&. " .in -1c .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template bool \fBatomic_compare_exchange_strong_explicit\fP (\fBshared_ptr\fP< _Tp > *__p, \fBshared_ptr\fP< _Tp > *__v, \fBshared_ptr\fP< _Tp > __w, \fBmemory_order\fP, \fBmemory_order\fP)" .br .RI "Atomic compare-and-swap for shared_ptr objects\&. " .in -1c .in -1c .SH "Detailed Description" .PP .SS "template .br class std::shared_ptr< _Tp >"A smart pointer with reference-counted copy semantics\&. A \fCshared_ptr\fP object is either empty or \fIowns\fP a pointer passed to the constructor\&. Copies of a \fCshared_ptr\fP share ownership of the same pointer\&. When the last \fCshared_ptr\fP that owns the pointer is destroyed or reset, the owned pointer is freed (either by \fCdelete\fP or by invoking a custom deleter that was passed to the constructor)\&. .PP A \fCshared_ptr\fP also stores another pointer, which is usually (but not always) the same pointer as it owns\&. The stored pointer can be retrieved by calling the \fCget()\fP member function\&. .PP The equality and relational operators for \fCshared_ptr\fP only compare the stored pointer returned by \fCget()\fP, not the owned pointer\&. To test whether two \fCshared_ptr\fP objects share ownership of the same pointer see \fCstd::shared_ptr::owner_before\fP and \fCstd::owner_less\fP\&. .SH "Member Typedef Documentation" .PP .SS "template using \fBstd::shared_ptr\fP< _Tp >::element_type = typename __shared_ptr<_Tp>::element_type" .PP The type pointed to by the stored pointer, remove_extent_t<_Tp> .SH "Constructor & Destructor Documentation" .PP .SS "template constexpr \fBstd::shared_ptr\fP< _Tp >::shared_ptr ()\fC [inline]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Construct an empty shared_ptr\&. .PP \fBPostcondition\fP .RS 4 use_count()==0 && get()==0 .RE .PP .SS "template \fBstd::shared_ptr\fP< _Tp >::shared_ptr (const \fBshared_ptr\fP< _Tp > &)\fC [default]\fP, \fC [noexcept]\fP" .PP Copy constructor\&. .SS "template template> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (_Yp * __p)\fC [inline]\fP, \fC [explicit]\fP" .PP Construct a shared_ptr that owns the pointer \fI__p\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP A pointer that is convertible to element_type*\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == 1 && get() == __p .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_alloc,in\fP which case \fCdelete\fP \fI__p\fP is called\&. .RE .PP .SS "template template> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (_Yp * __p, _Deleter __d)\fC [inline]\fP" .PP Construct a shared_ptr that owns the pointer \fI__p\fP and the deleter \fI__d\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP A pointer\&. .br \fI__d\fP A deleter\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == 1 && get() == __p .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_alloc,in\fP which case \fI__d(__p)\fP is called\&. .RE .PP Requirements: _Deleter's copy constructor and destructor must not throw .PP __shared_ptr will release __p by calling __d(__p) .SS "template template \fBstd::shared_ptr\fP< _Tp >::shared_ptr (nullptr_t __p, _Deleter __d)\fC [inline]\fP" .PP Construct a shared_ptr that owns a null pointer and the deleter \fI__d\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP A null pointer constant\&. .br \fI__d\fP A deleter\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == 1 && get() == __p .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_alloc,in\fP which case \fI__d(__p)\fP is called\&. .RE .PP Requirements: _Deleter's copy constructor and destructor must not throw .PP The last owner will call __d(__p) .SS "template template> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (_Yp * __p, _Deleter __d, _Alloc __a)\fC [inline]\fP" .PP Construct a shared_ptr that owns the pointer \fI__p\fP and the deleter \fI__d\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP A pointer\&. .br \fI__d\fP A deleter\&. .br \fI__a\fP An allocator\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == 1 && get() == __p .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_alloc,in\fP which case \fI__d(__p)\fP is called\&. .RE .PP Requirements: _Deleter's copy constructor and destructor must not throw _Alloc's copy constructor and destructor must not throw\&. .PP __shared_ptr will release __p by calling __d(__p) .SS "template template \fBstd::shared_ptr\fP< _Tp >::shared_ptr (nullptr_t __p, _Deleter __d, _Alloc __a)\fC [inline]\fP" .PP Construct a shared_ptr that owns a null pointer and the deleter \fI__d\fP\&. .PP \fBParameters\fP .RS 4 \fI__p\fP A null pointer constant\&. .br \fI__d\fP A deleter\&. .br \fI__a\fP An allocator\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == 1 && get() == __p .RE .PP \fBExceptions\fP .RS 4 \fIstd::bad_alloc,in\fP which case \fI__d(__p)\fP is called\&. .RE .PP Requirements: _Deleter's copy constructor and destructor must not throw _Alloc's copy constructor and destructor must not throw\&. .PP The last owner will call __d(__p) .SS "template template \fBstd::shared_ptr\fP< _Tp >::shared_ptr (const \fBshared_ptr\fP< _Yp > & __r, \fBelement_type\fP * __p)\fC [inline]\fP, \fC [noexcept]\fP" .PP Constructs a \fCshared_ptr\fP instance that stores \fC__p\fP and shares ownership with \fC__r\fP\&. .PP \fBParameters\fP .RS 4 \fI__r\fP A \fCshared_ptr\fP\&. .br \fI__p\fP A pointer that will remain valid while \fC*__r\fP is valid\&. .RE .PP \fBPostcondition\fP .RS 4 \fCget() == __p && use_count() == __r\&.use_count()\fP .RE .PP This can be used to construct a \fCshared_ptr\fP to a sub-object of an object managed by an existing \fCshared_ptr\fP\&. The complete object will remain valid while any \fCshared_ptr\fP owns it, even if they don't store a pointer to the complete object\&. .PP .PP .nf shared_ptr> pii(new pair()); shared_ptr pi(pii, &pii->first); assert(pii\&.use_count() == 2); .fi .PP .SS "template template&>> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (const \fBshared_ptr\fP< _Yp > & __r)\fC [inline]\fP, \fC [noexcept]\fP" .PP If \fI__r\fP is empty, constructs an empty shared_ptr; otherwise construct a shared_ptr that shares ownership with \fI__r\fP\&. .PP \fBParameters\fP .RS 4 \fI__r\fP A shared_ptr\&. .RE .PP \fBPostcondition\fP .RS 4 get() == __r\&.get() && use_count() == __r\&.use_count() .RE .PP .SS "template \fBstd::shared_ptr\fP< _Tp >::shared_ptr (\fBshared_ptr\fP< _Tp > && __r)\fC [inline]\fP, \fC [noexcept]\fP" .PP Move-constructs a shared_ptr instance from \fI__r\fP\&. .PP \fBParameters\fP .RS 4 \fI__r\fP A shared_ptr rvalue\&. .RE .PP \fBPostcondition\fP .RS 4 *this contains the old value of \fI__r\fP, \fI__r\fP is empty\&. .RE .PP .SS "template template>> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (\fBshared_ptr\fP< _Yp > && __r)\fC [inline]\fP, \fC [noexcept]\fP" .PP Move-constructs a shared_ptr instance from \fI__r\fP\&. .PP \fBParameters\fP .RS 4 \fI__r\fP A shared_ptr rvalue\&. .RE .PP \fBPostcondition\fP .RS 4 *this contains the old value of \fI__r\fP, \fI__r\fP is empty\&. .RE .PP .SS "template template&>> \fBstd::shared_ptr\fP< _Tp >::shared_ptr (const \fBweak_ptr\fP< _Yp > & __r)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs a shared_ptr that shares ownership with \fI__r\fP and stores a copy of the pointer stored in \fI__r\fP\&. .PP \fBParameters\fP .RS 4 \fI__r\fP A weak_ptr\&. .RE .PP \fBPostcondition\fP .RS 4 use_count() == __r\&.use_count() .RE .PP \fBExceptions\fP .RS 4 \fIbad_weak_ptr\fP when __r\&.expired(), in which case the constructor has no effect\&. .RE .PP .SS "template constexpr \fBstd::shared_ptr\fP< _Tp >::shared_ptr (nullptr_t)\fC [inline]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Construct an empty shared_ptr\&. .PP \fBPostcondition\fP .RS 4 use_count() == 0 && get() == nullptr .RE .PP .SH "Member Function Documentation" .PP .SS "template \fBelement_type\fP * std::__shared_ptr< _Tp, _Lp >::get (void) const\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP Return the stored pointer\&. .SS "template std::__shared_ptr< _Tp, _Lp >::operator bool () const\fC [inline]\fP, \fC [explicit]\fP, \fC [inherited]\fP" .PP Return true if the stored pointer is not null\&. .SS "template template bool std::__shared_ptr< _Tp, _Lp >::owner_before (__shared_ptr< _Tp1, _Lp > const & __rhs) const\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP Define an ordering based on ownership\&. This function defines a strict weak ordering between two shared_ptr or weak_ptr objects, such that one object is less than the other unless they share ownership of the same pointer, or are both empty\&. .SS "template template bool std::__shared_ptr< _Tp, _Lp >::owner_before (__weak_ptr< _Tp1, _Lp > const & __rhs) const\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP Define an ordering based on ownership\&. This function defines a strict weak ordering between two shared_ptr or weak_ptr objects, such that one object is less than the other unless they share ownership of the same pointer, or are both empty\&. .SS "template void std::__shared_ptr< _Tp, _Lp >::swap (__shared_ptr< _Tp, _Lp > & __other)\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP Exchange both the owned pointer and the stored pointer\&. .SS "template bool std::__shared_ptr< _Tp, _Lp >::unique () const\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP Return true if use_count() == 1\&. .SS "template long std::__shared_ptr< _Tp, _Lp >::use_count () const\fC [inline]\fP, \fC [noexcept]\fP, \fC [inherited]\fP" .PP If *this owns a pointer, return the number of owners, otherwise zero\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.