|
template<typename D = T, typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value > * = nullptr> |
| Unique_ptr () |
| Default class constructor, only to be used with no specific allocator. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value > * = nullptr> |
| Unique_ptr (A &alloc) |
| Class constructor, to be used with specific allocators, passing the allocator object to be used. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value &&std::is_array< D >::value > * = nullptr> |
| Unique_ptr (A &alloc, size_t size) |
| Class constructor, to be used with specific allocators and when T is an array type, passing the allocator object to be used and the size of the array. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value &&std::is_array< D >::value > * = nullptr> |
| Unique_ptr (size_t size) |
| Class constructor, to be used with no specific allocators and when T is an array type, passing the allocator object to be used and the size of the array. More...
|
|
template<typename... Args, typename D = T, typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value &&!std::is_array< D >::value > * = nullptr> |
| Unique_ptr (A &alloc, Args &&... args) |
| Class constructor, to be used with specific allocators and when T is not an array type, passing the allocator object to be used and the parameters to be used with T object constructor. More...
|
|
template<typename... Args, typename D = T, typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value &&!std::is_array< D >::value > * = nullptr> |
| Unique_ptr (Args &&... args) |
| Class constructor, to be used with no specific allocators and when T is not an array type, passing the parameters to be used with T object constructor. More...
|
|
| Unique_ptr (Unique_ptr< T, A > const &rhs)=delete |
|
| Unique_ptr (Unique_ptr< T, A > &&rhs) |
| Move constructor. More...
|
|
virtual | ~Unique_ptr () |
| Destructor for the class. More...
|
|
Unique_ptr< T, A > & | operator= (Unique_ptr< T, A > const &rhs)=delete |
|
Unique_ptr< T, A > & | operator= (Unique_ptr< T, A > &&rhs) |
| Move operator. More...
|
|
template<typename D = T, std::enable_if_t<!std::is_array< D >::value > * = nullptr> |
pointer | operator-> () const |
| Arrow operator to access the underlying object of type T . More...
|
|
reference | operator* () const |
| Star operator to access the underlying object of type T . More...
|
|
template<typename D = T, std::enable_if_t< std::is_array< D >::value > * = nullptr> |
reference | operator[] (size_t index) const |
| Subscript operator, to access an array element when T is of array type. More...
|
|
| operator bool () const |
| Casting operator to bool. More...
|
|
template<typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value > * = nullptr> |
pointer | release () |
| Releases the ownership of the underlying allocated memory and returns a pointer to the beginning of that memory. More...
|
|
template<typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value > * = nullptr> |
pointer | release () |
| Releases the ownership of the underlying allocated memory and returns a pointer to the beginning of that memory. More...
|
|
pointer | get () const |
| Returns a pointer to the underlying allocated memory. More...
|
|
size_t | size () const |
| The size of the memory allocated, in bytes. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t< std::is_array< D >::value &&std::is_same< B, std::nullptr_t >::value > * = nullptr> |
Unique_ptr< T, A > & | reserve (size_t new_size) |
| Will resize the allocated memory to new_size . More...
|
|
template<typename D = T, typename B = A, std::enable_if_t< std::is_array< D >::value &&!std::is_same< B, std::nullptr_t >::value > * = nullptr> |
Unique_ptr< T, A > & | reserve (size_t new_size) |
| Will resize the allocated memory to new_size . More...
|
|
A & | allocator () const |
| Returns the used allocator instance, if any. More...
|
|
template<typename D , std::enable_if_t<!std::is_array< D >::value > * > |
memory::Unique_ptr< T, A >::pointer | operator-> () const |
|
template<typename D , std::enable_if_t< std::is_array< D >::value > * > |
memory::Unique_ptr< T, A >::reference | operator[] (size_t index) const |
|
template<typename B , std::enable_if_t< std::is_same< B, std::nullptr_t >::value > * > |
memory::Unique_ptr< T, A >::pointer | release () |
|
template<typename D , typename B , std::enable_if_t< std::is_array< D >::value &&std::is_same< B, std::nullptr_t >::value > * > |
memory::Unique_ptr< T, A > & | reserve (size_t new_size) |
|
template<typename D , std::enable_if_t< std::is_array< D >::value > * > |
memory::Unique_ptr< T, A >::pointer | clone () const |
|
|
void | reset () |
| Clears the underlying pointer and size. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value &&std::is_array< D >::value > * = nullptr> |
void | destroy () |
| Deallocates the underlying allocated memory. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t< std::is_same< B, std::nullptr_t >::value &&!std::is_array< D >::value > * = nullptr> |
void | destroy () |
| Deallocates the underlying allocated memory. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value &&std::is_array< D >::value > * = nullptr> |
void | destroy () |
| Deallocates the underlying allocated memory. More...
|
|
template<typename D = T, typename B = A, std::enable_if_t<!std::is_same< B, std::nullptr_t >::value &&!std::is_array< D >::value > * = nullptr> |
void | destroy () |
| Deallocates the underlying allocated memory. More...
|
|
template<typename D = T, std::enable_if_t< std::is_array< D >::value > * = nullptr> |
pointer | clone () const |
| Clones the underlying memory and returns a pointer to the clone memory. More...
|
|
template<typename D = T, std::enable_if_t<!std::is_array< D >::value > * = nullptr> |
pointer | clone () const |
| Clones the underlying memory and returns a pointer to the clone memory. More...
|
|
template<typename T, typename A = std::nullptr_t>
class memory::Unique_ptr< T, A >
Smart pointer to hold a unique pointer to a heap allocated memory of type T
, constructed using a specific allocator.
Template parameters are as follows:
T
is the type of the pointer to allocate. It may be an array type.
A
the allocator to use. If none is passed, std::nullptr_t
is passed and regular new
and delete
are used to construct the memory.