|
libstdc++
|

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.
| constexpr std::shared_ptr< _Tp >::shared_ptr | ( | ) | [inline] |
Construct an empty shared_ptr.
Definition at line 100 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | _Tp1 * | __p | ) | [inline, explicit] |
Construct a shared_ptr that owns the pointer __p.
| __p | A pointer that is convertible to element_type*. |
| std::bad_alloc,in | which case delete __p is called. |
Definition at line 112 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | _Tp1 * | __p, |
| _Deleter | __d | ||
| ) | [inline] |
Construct a shared_ptr that owns the pointer __p and the deleter __d.
| __p | A pointer. |
| __d | A deleter. |
| 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.
| std::shared_ptr< _Tp >::shared_ptr | ( | nullptr_t | __p, |
| _Deleter | __d | ||
| ) | [inline] |
Construct a shared_ptr that owns a null pointer and the deleter __d.
| __p | A null pointer constant. |
| __d | A deleter. |
| std::bad_alloc,in | which case __d(__p) is called. |
Requirements: _Deleter's copy constructor and destructor must not throw
The last owner will call __d(__p)
Definition at line 146 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | _Tp1 * | __p, |
| _Deleter | __d, | ||
| _Alloc | __a | ||
| ) | [inline] |
Construct a shared_ptr that owns the pointer __p and the deleter __d.
| __p | A pointer. |
| __d | A deleter. |
| __a | An allocator. |
| 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.
| std::shared_ptr< _Tp >::shared_ptr | ( | nullptr_t | __p, |
| _Deleter | __d, | ||
| _Alloc | __a | ||
| ) | [inline] |
Construct a shared_ptr that owns a null pointer and the deleter __d.
| __p | A null pointer constant. |
| __d | A deleter. |
| __a | An allocator. |
| 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.
| std::shared_ptr< _Tp >::shared_ptr | ( | const shared_ptr< _Tp1 > & | __r, |
| _Tp * | __p | ||
| ) | [inline] |
Constructs a shared_ptr instance that stores __p and shares ownership with __r.
| <strong>r | A shared_ptr. |
| __p | A pointer that will remain valid while *r is valid. |
This can be used to construct a shared_ptr to a sub-object of an object managed by an existing shared_ptr.
shared_ptr< pair<int,int> > pii(new pair<int,int>());
shared_ptr<int> pi(pii, &pii->first);
assert(pii.use_count() == 2);
Definition at line 206 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | const shared_ptr< _Tp1 > & | __r | ) | [inline] |
If __r is empty, constructs an empty shared_ptr; otherwise construct a shared_ptr that shares ownership with __r.
| __r | A shared_ptr. |
Definition at line 218 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | shared_ptr< _Tp > && | __r | ) | [inline] |
Move-constructs a shared_ptr instance from __r.
| __r | A shared_ptr rvalue. |
Definition at line 226 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | shared_ptr< _Tp1 > && | __r | ) | [inline] |
Move-constructs a shared_ptr instance from __r.
| __r | A shared_ptr rvalue. |
Definition at line 236 of file shared_ptr.h.
| std::shared_ptr< _Tp >::shared_ptr | ( | const weak_ptr< _Tp1 > & | __r | ) | [inline, explicit] |
Constructs a shared_ptr that shares ownership with __r and stores a copy of the pointer stored in __r.
| __r | A weak_ptr. |
| bad_weak_ptr | when __r.expired(), in which case the constructor has no effect. |
Definition at line 248 of file shared_ptr.h.
| constexpr std::shared_ptr< _Tp >::shared_ptr | ( | nullptr_t | __p | ) | [inline] |
Construct an empty shared_ptr.
| __p | A null pointer constant. |
Definition at line 266 of file shared_ptr.h.
| shared_ptr<_Tp1> allocate_shared | ( | const _Alloc & | __a, |
| _Args &&... | __args | ||
| ) | [friend] |
Create an object that is owned by a shared_ptr.
| __a | An allocator. |
| __args | Arguments for the _Tp object's constructor. |
| 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 596 of file shared_ptr.h.