|
Lagrange
|
NOT implemented: custom allocator support. More...
#include <lagrange/internal/shared_ptr.h>
Inherits shared_ptr_access< T, bool, bool >.
Public Types | |
| using | element_type = typename shared_ptr_access< T >::element_type |
| using | weak_type = weak_ptr< T > |
Public Types inherited from shared_ptr_access< T, bool, bool > | |
| using | element_type = T |
Public Member Functions | |
| constexpr | shared_ptr () noexcept |
| Default constructor, creates a shared_ptr with no managed object Postconditions: use_count() == 0 && get() == 0. | |
| constexpr | shared_ptr (std::nullptr_t) noexcept |
| Constructs a shared_ptr with no managed object Postconditions: use_count() == 0 && get() == 0. | |
| template<typename U > | |
| shared_ptr (U *p) | |
| Constructs a shared_ptr with p as the pointer to the managed object Postconditions: use_count() == 1 && get() == p. | |
| template<typename U , typename D , typename A > | |
| shared_ptr (U *p, D d, A a)=delete | |
| Constructs a shared_ptr with p as the pointer to the managed object, supplied with custom deleter and allocator Postconditions: use_count() == 1 && get() == p. | |
| template<typename D , typename A > | |
| shared_ptr (std::nullptr_t p, D d, A a)=delete | |
| Constructs a shared_ptr with no managed object, supplied with custom deleter and allocator Postconditions: use_count() == 1 && get() == 0. | |
| template<typename U > | |
| shared_ptr (const shared_ptr< U > &sp, T *p) noexcept | |
| Aliasing constructor: constructs a shared_ptr instance that stores p and shares ownership with sp Postconditions: use_count() == sp.use_count() && get() == p. | |
| shared_ptr (const shared_ptr &sp) noexcept | |
| Copy constructor: shares ownership of the object managed by sp Postconditions: use_count() == sp.use_count() && get() == sp.get(). | |
| template<typename U > | |
| shared_ptr (const shared_ptr< U > &sp) noexcept | |
| Copy constructor: shares ownership of the object managed by sp Postconditions: use_count() == sp.use_count() && get() == sp.get(). | |
| shared_ptr (shared_ptr &&sp) noexcept | |
| Move constructor: Move-constructs a shared_ptr from sp Postconditions: *this shall contain the old value of sp. More... | |
| template<typename U > | |
| shared_ptr (shared_ptr< U > &&sp) noexcept | |
| Move constructor: Move-constructs a shared_ptr from sp Postconditions: *this shall contain the old value of sp. More... | |
| template<typename U > | |
| shared_ptr (const weak_ptr< U > &wp) | |
| Constructs a shared_ptr object that shares ownership with wp Postconditions: use_count() == wp.use_count(). | |
| shared_ptr & | operator= (const shared_ptr &sp) noexcept |
| Copy assignment. | |
| template<typename U > | |
| shared_ptr & | operator= (const shared_ptr< U > &sp) noexcept |
| Copy assignment. | |
| shared_ptr & | operator= (shared_ptr &&sp) noexcept |
| Move assignment. | |
| template<typename U > | |
| shared_ptr & | operator= (shared_ptr< U > &&sp) noexcept |
| Move assignment. | |
| void | swap (shared_ptr &sp) noexcept |
| Exchanges the contents of *this and sp. | |
| void | reset () noexcept |
| Resets *this to empty. | |
| template<typename U > | |
| void | reset (U *p) |
| Resets *this with p as the pointer to the managed object. | |
| template<typename U , typename D > | |
| void | reset (U *p, D d) |
| Resets *this with p as the pointer to the managed object, supplied with custom deleter. | |
| template<typename U , typename D , typename A > | |
| void | reset (U *p, D d, A a)=delete |
| Resets *this with p as the pointer to the managed object, supplied with custom deleter and allocator. | |
| element_type * | get () const noexcept |
| Gets the stored pointer. | |
| long | use_count () const noexcept |
| Gets use_count. | |
| bool | unique () const noexcept |
| Checks if use_count == 1. | |
| operator bool () const noexcept | |
| Checks if there is a managed object. | |
Public Member Functions inherited from shared_ptr_access< T, bool, bool > | |
| element_type & | operator* () const noexcept |
| Dereferences pointer to the managed object. | |
| element_type * | operator-> () const noexcept |
| Dereferences pointer to the managed object. | |
NOT implemented: custom allocator support.
The allocator is intended to be used to allocate and deallocate internal shared_ptr details, not the object.
|
inlinenoexcept |
Move constructor: Move-constructs a shared_ptr from sp Postconditions: *this shall contain the old value of sp.
sp shall be empty. sp.get() == 0.
|
inlinenoexcept |
Move constructor: Move-constructs a shared_ptr from sp Postconditions: *this shall contain the old value of sp.
sp shall be empty. sp.get() == 0.