Inherits std::__shared_ptr< _Tp, _Lp >.
|
constexpr | shared_ptr () noexcept |
|
| shared_ptr (const shared_ptr &) noexcept=default |
|
template<typename _Tp1 > |
| shared_ptr (_Tp1 *__p) |
|
template<typename _Tp1 , typename _Deleter > |
| shared_ptr (_Tp1 *__p, _Deleter __d) |
|
template<typename _Deleter > |
| shared_ptr (nullptr_t __p, _Deleter __d) |
|
template<typename _Tp1 , typename _Deleter , typename _Alloc > |
| shared_ptr (_Tp1 *__p, _Deleter __d, _Alloc __a) |
|
template<typename _Deleter , typename _Alloc > |
| shared_ptr (nullptr_t __p, _Deleter __d, _Alloc __a) |
|
template<typename _Tp1 > |
| shared_ptr (const shared_ptr< _Tp1 > &__r, _Tp *__p) noexcept |
|
template<typename _Tp1 , typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> |
| shared_ptr (const shared_ptr< _Tp1 > &__r) noexcept |
|
| shared_ptr (shared_ptr &&__r) noexcept |
|
template<typename _Tp1 , typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> |
| shared_ptr (shared_ptr< _Tp1 > &&__r) noexcept |
|
template<typename _Tp1 > |
| shared_ptr (const weak_ptr< _Tp1 > &__r) |
|
template<typename _Tp1 , typename _Del > |
| shared_ptr (std::unique_ptr< _Tp1, _Del > &&__r) |
|
constexpr | shared_ptr (nullptr_t __p) noexcept |
|
template<typename _Tp1 > |
| shared_ptr (std::auto_ptr< _Tp1 > &&__r) |
|
_Tp * | get () const noexcept |
|
| operator bool () const |
|
std::add_lvalue_reference< _Tp >
::type | operator* () const noexcept |
|
_Tp * | operator-> () const noexcept |
|
shared_ptr & | operator= (const shared_ptr &) noexcept=default |
|
template<typename _Tp1 > |
shared_ptr & | operator= (const shared_ptr< _Tp1 > &__r) noexcept |
|
shared_ptr & | operator= (shared_ptr &&__r) noexcept |
|
template<class _Tp1 > |
shared_ptr & | operator= (shared_ptr< _Tp1 > &&__r) noexcept |
|
template<typename _Tp1 , typename _Del > |
shared_ptr & | operator= (std::unique_ptr< _Tp1, _Del > &&__r) |
|
template<typename _Tp1 > |
bool | owner_before (__shared_ptr< _Tp1, _Lp > const &__rhs) const |
|
template<typename _Tp1 > |
bool | owner_before (__weak_ptr< _Tp1, _Lp > const &__rhs) const |
|
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 |
|
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 shared_ptr.h.
template<typename _Tp>
template<typename _Tp1 , typename _Deleter >
Construct a shared_ptr that owns the pointer __p and the deleter __d.
- Parameters
-
__p | A pointer. |
__d | A deleter. |
- Postcondition
- use_count() == 1 && get() == __p
- Exceptions
-
std::bad_alloc,in | which case __d(__p) is called. |
Requirements: _Deleter's copy constructor and destructor must not throw
__shared_ptr will release __p by calling __d(__p)
Definition at line 129 of file shared_ptr.h.
template<typename _Tp>
template<typename _Tp1 , typename _Deleter , typename _Alloc >
Construct a shared_ptr that owns the pointer __p and the deleter __d.
- Parameters
-
__p | A pointer. |
__d | A deleter. |
__a | An allocator. |
- Postcondition
- use_count() == 1 && get() == __p
- Exceptions
-
std::bad_alloc,in | which case __d(__p) is called. |
Requirements: _Deleter's copy constructor and destructor must not throw _Alloc's copy constructor and destructor must not throw.
__shared_ptr will release __p by calling __d(__p)
Definition at line 165 of file shared_ptr.h.
template<typename _Tp>
template<typename _Deleter , typename _Alloc >
Construct a shared_ptr that owns a null pointer and the deleter __d.
- Parameters
-
__p | A null pointer constant. |
__d | A deleter. |
__a | An allocator. |
- Postcondition
- use_count() == 1 && get() == __p
- Exceptions
-
std::bad_alloc,in | which case __d(__p) is called. |
Requirements: _Deleter's copy constructor and destructor must not throw _Alloc's copy constructor and destructor must not throw.
The last owner will call __d(__p)
Definition at line 184 of file shared_ptr.h.
template<typename _Tp>
template<typename _Tp1 , typename _Alloc , typename... _Args>
shared_ptr<_Tp1> allocate_shared |
( |
const _Alloc & |
__a, |
|
|
_Args &&... |
__args |
|
) |
| |
|
friend |
Create an object that is owned by a shared_ptr.
- Parameters
-
__a | An allocator. |
__args | Arguments for the _Tp object's constructor. |
- Returns
- A shared_ptr that owns the newly created object.
- Exceptions
-
An | exception thrown from _Alloc::allocate or from the constructor of _Tp. |
A copy of __a will be used to allocate memory for the shared_ptr and the new object.
Definition at line 595 of file shared_ptr.h.