mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-18 10:06:54 +01:00
96e77c0240
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@218 f6dd340e-d3f9-0310-b409-bdd246841980
20 lines
863 B
Text
20 lines
863 B
Text
We've already seen the third hi(unique_ptr: empty) form to create an
|
|
tt(unique_ptr) object: Without arguments an empty tt(unique_ptr) object is
|
|
constructed not pointing to a particular block of memory:
|
|
verb(
|
|
unique_ptr<type> identifier;
|
|
)
|
|
In this case the hi(unique_ptr: 0-pointer) underlying pointer is set to
|
|
tt(0) (zero). Although the tt(unique_ptr) object itself is not the pointer,
|
|
its value em(can) be compared to tt(0) to see if it has been
|
|
initialized. E.g., code like
|
|
verb(
|
|
unique_ptr<int> ip;
|
|
|
|
if (!ip)
|
|
cout << "0-pointer with a unique_ptr object" << endl;
|
|
)
|
|
will produce the shown text. Alternatively, the member
|
|
hi(unique_ptr<>::get()) tt(get()) is available. This member function,
|
|
as well as the other member functions of the class tt(unique_ptr) are
|
|
described in the next section.
|