C++ Memory Library - unique_ptr


Advertisements

Description

It manages the storage of a pointer, providing a limited garbage-collection facility, with little to no overhead over built-in pointers.

Declaration

Following is the declaration for std::unique_ptr function.

template <class T, class D = default_delete<T>> class unique_ptr;	
template <class T, class D> class unique_ptr<T[],D>;

C++11

template <class T, class D = default_delete<T>> class unique_ptr;	
template <class T, class D> class unique_ptr<T[],D>;

Parameters

T − It is a managed object.

Member types

member type definition notes
element_type class template parameter (T) The type of the managed object
deleter_type It is a second template parameter (D) The type of the managed object
pointer It is used to remove_reference(D) It is a Pointer Type.
memory.htm
Advertisements