|
constexpr | shared_ptr () |
| Construct an empty shared_ptr. More...
|
|
| shared_ptr (const shared_ptr &)=default |
|
template<typename _Tp1 > |
| shared_ptr (_Tp1 *__p) |
| Construct a shared_ptr that owns the pointer __p. More...
|
|
template<typename _Tp1 , typename _Deleter > |
| shared_ptr (_Tp1 *__p, _Deleter __d) |
| Construct a shared_ptr that owns the pointer __p and the deleter __d. More...
|
|
template<typename _Deleter > |
| shared_ptr (nullptr_t __p, _Deleter __d) |
| Construct a shared_ptr that owns a null pointer and the deleter __d. More...
|
|
template<typename _Tp1 , typename _Deleter , typename _Alloc > |
| shared_ptr (_Tp1 *__p, _Deleter __d, _Alloc __a) |
| Construct a shared_ptr that owns the pointer __p and the deleter __d. More...
|
|
template<typename _Deleter , typename _Alloc > |
| shared_ptr (nullptr_t __p, _Deleter __d, _Alloc __a) |
| Construct a shared_ptr that owns a null pointer and the deleter __d. More...
|
|
template<typename _Tp1 , typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> |
| shared_ptr (const shared_ptr< _Tp1 > &__r) |
| If __r is empty, constructs an empty shared_ptr; otherwise construct a shared_ptr that shares ownership with __r. More...
|
|
| shared_ptr (shared_ptr &&__r) |
| Move-constructs a shared_ptr instance from __r. More...
|
|
| shared_ptr (std::shared_ptr< _Tp > &&__ptr) |
| Move-constructs a shared_ptr instance from __r. More...
|
|
template<typename _Tp1 , typename = typename std::enable_if<std::is_convertible<_Tp1*, _Tp*>::value>::type> |
| shared_ptr (shared_ptr< _Tp1 > &&__r) |
| Move-constructs a shared_ptr instance from __r. More...
|
|
template<typename _Tp1 > |
| shared_ptr (const weak_ptr< _Tp1 > &__r) |
| Constructs a shared_ptr that shares ownership with __r and stores a copy of the pointer stored in __r. More...
|
|
template<typename _Tp1 , typename _Del > |
| shared_ptr (std::unique_ptr< _Tp1, _Del > &&__r) |
|
constexpr | shared_ptr (nullptr_t __p) |
| Construct an empty shared_ptr. More...
|
|
| shared_ptr (const std::shared_ptr< _Tp > &_ptr) |
|
shared_ptr & | operator= (const shared_ptr &)=default |
|
template<typename _Tp1 > |
shared_ptr & | operator= (const shared_ptr< _Tp1 > &__r) |
|
shared_ptr & | operator= (shared_ptr &&__r) |
|
template<class _Tp1 > |
shared_ptr & | operator= (shared_ptr< _Tp1 > &&__r) |
|
template<typename _Tp1 , typename _Del > |
shared_ptr & | operator= (std::unique_ptr< _Tp1, _Del > &&__r) |
|
void | reset () |
|
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) |
|
std::add_lvalue_reference< _Tp >::type | operator* () const |
|
_Tp * | operator-> () const |
|
bool | expired (void) const |
|
_Tp * | get () const |
|
| operator bool () const |
|
bool | unique () const |
|
long | use_count () const |
|
void | swap (std::__shared_ptr< _Tp, _Lp > &__other) |
|
template<typename _Tp1 > |
bool | owner_before (std::__shared_ptr< _Tp1, _Lp > const &__rhs) const |
|
template<typename _Tp1 > |
bool | owner_before (std::__weak_ptr< _Tp1, _Lp > const &__rhs) const |
|
template<typename _Tp, std::_Lock_policy _Lp = std::__default_lock_policy>
class jle::shared_ptr< _Tp, _Lp >
A safe std smart pointer WRAPPER.
It's almost equal to std::shared_ptr but... has the method exprired and if you try to access to noninitializated pointer, an exception will be throw
No external dependencies
Example:
- Examples:
- /core/ex_shared_ptr.cpp, /core/ex_test.cpp, /core/ex_weak_ptr.cpp, and /net/ex_http_server.cpp.
template<typename _Tp, std::_Lock_policy _Lp = std::__default_lock_policy>
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)