mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-18 10:06:54 +01:00
adfdbd42d9
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@360 f6dd340e-d3f9-0310-b409-bdd246841980
31 lines
1.4 KiB
Text
31 lines
1.4 KiB
Text
There are three ways to hi(unique_ptr: defining) define tt(unique_ptr)
|
|
objects. Each definition contains the usual tt(<type>) specifier between
|
|
angle brackets:
|
|
itemization(
|
|
it() The default constructor simply creates a tt(unique_ptr) object that
|
|
does not point to a particular block of memory. Its pointer is initialized to
|
|
0 (zero):
|
|
verb(
|
|
unique_ptr<type> identifier;
|
|
)
|
|
This form is discussed in section ref(UNIQUEPLAIN).
|
|
it() The em(move constructor) initializes an tt(unique_ptr) object.
|
|
Following the use of the move constructor its tt(unique_ptr) argument no
|
|
longer points to the dynamically allocated memory and its pointer data member
|
|
is turned into a zero-pointer:
|
|
verb(
|
|
unique_ptr<type> identifier(another unique_ptr for type);
|
|
|
|
This form is discussed in section ref(UNIQUEMOVE).
|
|
it() The form that is used most often initializes a tt(unique_ptr) object
|
|
to the block of dynamically allocated memory that is passed to the object's
|
|
constructor. Optionally ti(deleter) can be provided. A (free) function (or
|
|
function object) receiving the tt(unique_ptr)'s pointer as its argument can be
|
|
passed as deleter. It is supposed to return the dynamically allocated
|
|
memory to the common pool (doing nothing if the pointer equals zero).
|
|
verb(
|
|
unique_ptr<type> identifier (new-expression [, deleter]);
|
|
)
|
|
This form is discussed in section ref(UNIQUENEW).
|
|
)
|
|
|