A simple unique_ptr, for a single object. More...
#include <mn_unique_ptr.hpp>
Public Types | |
using | value_type = T |
using | pointer = T * |
using | const_pointer = const T * |
using | reference = T & |
using | const_reference = const T & |
using | deleter_type = TDeleter |
using | allotor_type = TAllocator |
using | self_type = basic_unique_ptr< value_type, allotor_type, deleter_type > |
Public Types inherited from mn::only_move_tag< void > | |
using | this_type = only_move_tag |
Public Member Functions | |
constexpr | basic_unique_ptr () noexcept |
Constructor a basic_unique_ptr that owns nothing. More... | |
constexpr | basic_unique_ptr (nullptr_t) noexcept |
Creates a unique_ptr that owns nothing. More... | |
basic_unique_ptr (pointer pPointer) noexcept | |
Takes ownership of a pointer. More... | |
basic_unique_ptr (pointer pPointer, deleter_type &deleter) noexcept | |
Takes ownership of a pointer. More... | |
basic_unique_ptr (pointer pPointer, const deleter_type &deleter) noexcept | |
Takes ownership of a pointer. More... | |
basic_unique_ptr (pointer pPointer, deleter_type &&deleter) noexcept | |
Takes ownership of a pointer. More... | |
basic_unique_ptr (self_type &&other) | |
Move constructor. More... | |
template<typename U , class UAllocator = memory::default_allocator, class UDeleter = memory::default_delete<U, UAllocator>> | |
basic_unique_ptr (basic_unique_ptr< U, UAllocator, UDeleter > &&other) noexcept | |
Converting constructor from another type. More... | |
~basic_unique_ptr () noexcept | |
Destructor, invokes the deleter if the stored pointer is not null. More... | |
self_type & | operator= (self_type &&other) noexcept |
Move assignment operator. More... | |
template<typename U , class UAllocator = memory::default_allocator, class UDeleter = memory::default_delete<U, UAllocator>> | |
self_type & | operator= (basic_unique_ptr< U, UAllocator, UDeleter > &&other) noexcept |
Move assignment operator. More... | |
pointer | release () noexcept |
Release ownership of any stored pointer. More... | |
void | reset (pointer pPtr) noexcept |
Replace the stored pointer. More... | |
void | swap (self_type &other) noexcept |
Exchange the pointer and deleter with another object. More... | |
pointer | get () const noexcept |
Get the stored pointer. More... | |
deleter_type & | get_deleter () noexcept |
Get a reference to the stored deleter. More... | |
const deleter_type & | get_deleter () const noexcept |
Get a reference to the stored deleter. More... | |
reference | operator* () const |
Return the stored pointer as reference. More... | |
pointer | operator-> () const noexcept |
Return the stored pointer. More... | |
operator bool () const noexcept | |
Is the stored pointer not null? More... | |
Public Member Functions inherited from mn::only_move_tag< void > | |
only_move_tag ()=default | |
only_move_tag (this_type &&other)=default | |
only_move_tag (const this_type &)=delete | |
this_type & | operator= (const this_type &)=delete |
this_type & | operator= (this_type &&other)=default |
Private Attributes | |
pointer | m_ptr |
deleter_type & | m_refDeleter |
Detailed Description
template<typename T, class TAllocator = memory::default_allocator, class TDeleter = memory::default_delete<T, TAllocator>>
class mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >
A simple unique_ptr, for a single object.
- Template Parameters
-
T The type of the stored pointer. TAllocator The type of the using allocator, for the deleter. TDeleter The type of the using deleter.
Member Typedef Documentation
◆ allotor_type
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::allotor_type = TAllocator |
◆ const_pointer
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::const_pointer = const T* |
◆ const_reference
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::const_reference = const T& |
◆ deleter_type
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::deleter_type = TDeleter |
◆ pointer
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::pointer = T* |
◆ reference
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::reference = T& |
◆ self_type
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::self_type = basic_unique_ptr<value_type, allotor_type, deleter_type> |
◆ value_type
using mn::pointer::basic_unique_ptr< T, TAllocator, TDeleter >::value_type = T |
Constructor & Destructor Documentation
◆ basic_unique_ptr() [1/8]
|
inlineconstexprnoexcept |
Constructor a basic_unique_ptr that owns nothing.
◆ basic_unique_ptr() [2/8]
|
inlineconstexprnoexcept |
Creates a unique_ptr that owns nothing.
◆ basic_unique_ptr() [3/8]
|
inlineexplicitnoexcept |
Takes ownership of a pointer.
◆ basic_unique_ptr() [4/8]
|
inlinenoexcept |
Takes ownership of a pointer.
- Parameters
-
pPointer A pointer to an object of element_type
deleter A reference to a deleter.
◆ basic_unique_ptr() [5/8]
|
inlinenoexcept |
Takes ownership of a pointer.
- Parameters
-
pPointer A pointer to an object of element_type
deleter A reference to a deleter.
◆ basic_unique_ptr() [6/8]
|
inlinenoexcept |
Takes ownership of a pointer.
- Parameters
-
pPointer A pointer to an object of element_type
deleter An rvalue reference to a deleter.
◆ basic_unique_ptr() [7/8]
|
inline |
Move constructor.
◆ basic_unique_ptr() [8/8]
|
inlinenoexcept |
Converting constructor from another type.
◆ ~basic_unique_ptr()
|
inlinenoexcept |
Destructor, invokes the deleter if the stored pointer is not null.
Member Function Documentation
◆ get()
|
inlinenoexcept |
Get the stored pointer.
- Returns
- The stored pointer.
◆ get_deleter() [1/2]
|
inlinenoexcept |
Get a reference to the stored deleter.
- Returns
- The reference to the stored deleter.
◆ get_deleter() [2/2]
|
inlinenoexcept |
Get a reference to the stored deleter.
- Returns
- The reference to the stored deleter.
◆ operator bool()
|
inlineexplicitnoexcept |
Is the stored pointer not null?
- Returns
- true if the stored pointer is not null.
◆ operator*()
|
inline |
Return the stored pointer as reference.
◆ operator->()
|
inlinenoexcept |
Return the stored pointer.
◆ operator=() [1/2]
|
inlinenoexcept |
Move assignment operator.
- Parameters
-
other The object to transfer ownership from.
- Returns
- this
◆ operator=() [2/2]
|
inlinenoexcept |
Move assignment operator.
- Parameters
-
other The object to transfer ownership from.
- Returns
- this
◆ release()
|
inlinenoexcept |
Release ownership of any stored pointer.
- Returns
- The stored pointer, bevor it set to null.
◆ reset()
|
inlinenoexcept |
Replace the stored pointer.
◆ swap()
|
inlinenoexcept |
Exchange the pointer and deleter with another object.
Member Data Documentation
◆ m_ptr
|
private |
◆ m_refDeleter
|
private |
The documentation for this class was generated from the following file: