libstdc++
std::shared_ptr< _Tp > Class Template Reference

#include <shared_ptr.h>

Inherits std::__shared_ptr< _Tp, _Lp >.

Public Types

typedef _Tp element_type
 

Public Member Functions

constexpr shared_ptr () noexcept
 
template<typename _Tp1 >
 shared_ptr (_Tp1 *__p)
 
template<typename _Tp1 , typename _Deleter >
 shared_ptr (_Tp1 *__p, _Deleter __d)
 
template<typename _Tp1 , typename _Deleter , typename _Alloc >
 shared_ptr (_Tp1 *__p, _Deleter __d, _Alloc __a)
 
 shared_ptr (const shared_ptr &) noexcept=default
 
template<typename _Tp1 , typename = _Convertible<_Tp1*>>
 shared_ptr (const shared_ptr< _Tp1 > &__r) noexcept
 
template<typename _Tp1 >
 shared_ptr (const shared_ptr< _Tp1 > &__r, _Tp *__p) noexcept
 
template<typename _Tp1 >
 shared_ptr (const weak_ptr< _Tp1 > &__r)
 
template<typename _Deleter >
 shared_ptr (nullptr_t __p, _Deleter __d)
 
template<typename _Deleter , typename _Alloc >
 shared_ptr (nullptr_t __p, _Deleter __d, _Alloc __a)
 
constexpr shared_ptr (nullptr_t) noexcept
 
 shared_ptr (shared_ptr &&__r) noexcept
 
template<typename _Tp1 , typename = _Convertible<_Tp1*>>
 shared_ptr (shared_ptr< _Tp1 > &&__r) noexcept
 
template<typename _Tp1 >
 shared_ptr (std::auto_ptr< _Tp1 > &&__r)
 
template<typename _Tp1 , typename _Del , typename = _Convertible<typename unique_ptr<_Tp1, _Del>::pointer>>
 shared_ptr (std::unique_ptr< _Tp1, _Del > &&__r)
 
_Tp * get () const noexcept
 
 operator bool () const
 
std::add_lvalue_reference< _Tp >::type operator* () const noexcept
 
_Tp * operator-> () const noexcept
 
shared_ptroperator= (const shared_ptr &) noexcept=default
 
template<typename _Tp1 >
shared_ptroperator= (const shared_ptr< _Tp1 > &__r) noexcept
 
shared_ptroperator= (shared_ptr &&__r) noexcept
 
template<class _Tp1 >
shared_ptroperator= (shared_ptr< _Tp1 > &&__r) noexcept
 
template<typename _Tp1 , typename _Del >
shared_ptroperator= (std::unique_ptr< _Tp1, _Del > &&__r)
 
template<typename _Tp1 >
bool owner_before (__shared_ptr< _Tp1, _Lp > const &__rhs) const noexcept
 
template<typename _Tp1 >
bool owner_before (__weak_ptr< _Tp1, _Lp > const &__rhs) const noexcept
 
void reset () noexcept
 
template<typename _Tp1 >
void reset (_Tp1 *__p)
 
template<typename _Tp1 , typename _Deleter >
void reset (_Tp1 *__p, _Deleter __d)
 
template<typename _Tp1 , typename _Deleter , typename _Alloc >
void reset (_Tp1 *__p, _Deleter __d, _Alloc __a)
 
void swap (__shared_ptr< _Tp, _Lp > &__other) noexcept
 
bool unique () const noexcept
 
long use_count () const noexcept
 

Friends

template<typename _Tp1 , typename _Alloc , typename... _Args>
shared_ptr< _Tp1allocate_shared (const _Alloc &__a, _Args &&... __args)
 
class weak_ptr< _Tp >
 

Detailed Description

template<typename _Tp>
class std::shared_ptr< _Tp >

A smart pointer with reference-counted copy semantics.

The object pointed to is deleted when the last shared_ptr pointing to it is destroyed or reset.

Definition at line 93 of file bits/shared_ptr.h.

Member Typedef Documentation

◆ element_type

template<typename _Tp , _Lock_policy _Lp>
typedef _Tp std::__shared_ptr< _Tp, _Lp >::element_type
inherited

Definition at line 877 of file shared_ptr_base.h.

Constructor & Destructor Documentation

◆ shared_ptr()

template<typename _Tp >
template<typename _Tp1 >
std::shared_ptr< _Tp >::shared_ptr ( std::auto_ptr< _Tp1 > &&  __r)
inline

Definition at line 316 of file auto_ptr.h.

Member Function Documentation

◆ get()

template<typename _Tp , _Lock_policy _Lp>
_Tp * std::__shared_ptr< _Tp, _Lp >::get ( ) const
inlinenoexceptinherited

Definition at line 1062 of file shared_ptr_base.h.

◆ operator bool()

template<typename _Tp , _Lock_policy _Lp>
std::__shared_ptr< _Tp, _Lp >::operator bool ( ) const
inlineexplicitinherited

Definition at line 1065 of file shared_ptr_base.h.

◆ operator*()

template<typename _Tp , _Lock_policy _Lp>
std::add_lvalue_reference< _Tp >::type std::__shared_ptr< _Tp, _Lp >::operator* ( ) const
inlinenoexceptinherited

Definition at line 1048 of file shared_ptr_base.h.

◆ operator->()

template<typename _Tp , _Lock_policy _Lp>
_Tp * std::__shared_ptr< _Tp, _Lp >::operator-> ( ) const
inlinenoexceptinherited

Definition at line 1055 of file shared_ptr_base.h.

◆ owner_before() [1/2]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 >
bool std::__shared_ptr< _Tp, _Lp >::owner_before ( __shared_ptr< _Tp1, _Lp > const __rhs) const
inlinenoexceptinherited

Definition at line 1085 of file shared_ptr_base.h.

◆ owner_before() [2/2]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 >
bool std::__shared_ptr< _Tp, _Lp >::owner_before ( __weak_ptr< _Tp1, _Lp > const __rhs) const
inlinenoexceptinherited

Definition at line 1090 of file shared_ptr_base.h.

◆ reset() [1/4]

template<typename _Tp , _Lock_policy _Lp>
void std::__shared_ptr< _Tp, _Lp >::reset ( )
inlinenoexceptinherited

Definition at line 1024 of file shared_ptr_base.h.

◆ reset() [2/4]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 >
void std::__shared_ptr< _Tp, _Lp >::reset ( _Tp1 __p)
inlineinherited

Definition at line 1029 of file shared_ptr_base.h.

◆ reset() [3/4]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 , typename _Deleter >
void std::__shared_ptr< _Tp, _Lp >::reset ( _Tp1 __p,
_Deleter  __d 
)
inlineinherited

Definition at line 1038 of file shared_ptr_base.h.

◆ reset() [4/4]

template<typename _Tp , _Lock_policy _Lp>
template<typename _Tp1 , typename _Deleter , typename _Alloc >
void std::__shared_ptr< _Tp, _Lp >::reset ( _Tp1 __p,
_Deleter  __d,
_Alloc  __a 
)
inlineinherited

Definition at line 1043 of file shared_ptr_base.h.

◆ swap()

template<typename _Tp , _Lock_policy _Lp>
void std::__shared_ptr< _Tp, _Lp >::swap ( __shared_ptr< _Tp, _Lp > &  __other)
inlinenoexceptinherited

Definition at line 1077 of file shared_ptr_base.h.

◆ unique()

template<typename _Tp , _Lock_policy _Lp>
bool std::__shared_ptr< _Tp, _Lp >::unique ( ) const
inlinenoexceptinherited

Definition at line 1069 of file shared_ptr_base.h.

◆ use_count()

template<typename _Tp , _Lock_policy _Lp>
long std::__shared_ptr< _Tp, _Lp >::use_count ( ) const
inlinenoexceptinherited

Definition at line 1073 of file shared_ptr_base.h.


The documentation for this class was generated from the following files: