#include <zorba/internal/unique_ptr.h>
Public Types | |
typedef D | deleter_type |
typedef T | element_type |
typedef T * | pointer |
Public Member Functions | |
pointer | get () const throw () |
Gets the pointer. | |
deleter_reference | get_deleter () throw () |
Gets the deleter in use. | |
deleter_const_reference | get_deleter () const throw () |
Gets the deleter in use. | |
operator explicit_bool () const throw () | |
Conversion to bool . | |
element_type & | operator* () const throw () |
Dereferences the pointer. | |
pointer | operator-> () const throw () |
Gets the pointer. | |
operator::zorba::internal::rv () throw () | |
operator::zorba::internal::rv () const throw () | |
unique_ptr & | operator= (zorba::internal::rv< unique_ptr > &p) |
Destructive assignment: moves ownership of the object pointed-to by p to this unique_ptr. | |
template<typename U , typename E > | |
unique_ptr & | operator= (zorba::internal::rv< unique_ptr< U, E > > &p) |
Destructive assignment: moves ownership of the object pointed-to by p to this unique_ptr. | |
unique_ptr & | operator= (int) |
Assignment from null: equivalent to reset() . | |
pointer | release () throw () |
Releases ownership of the pointed-to object. | |
void | reset (pointer p=0) throw () |
Sets the pointer to the given value or null if none. | |
void | swap (unique_ptr &p) |
Swaps the pointer and deleter with that of another unique_ptr. | |
unique_ptr (pointer p=0) throw () | |
Default constructor. | |
unique_ptr (pointer p, deleter_reference d) | |
Constructs a unique_ptr using a specific deleter. | |
unique_ptr (zorba::internal::rv< unique_ptr > &p) | |
Constructs a unique_ptr from an existing unique_ptr. | |
template<typename U , typename E > | |
unique_ptr (zorba::internal::rv< unique_ptr< U, E > > &p, typename enable_if< ZORBA_TR1_NS::is_convertible< typename unique_ptr< U >::pointer, pointer >::value &&ZORBA_TR1_NS::is_convertible< E, D >::value &&(!ZORBA_TR1_NS::is_reference< D >::value||ZORBA_TR1_NS::is_same< D, E >::value) >::type *=0) | |
Constructs a unique_ptr from an existing unique_ptr. | |
~unique_ptr () | |
Destroys the pointed-to object by calling the deleter (if the pointer is not null). |
Definition at line 201 of file unique_ptr.h.
typedef D std::unique_ptr< T, D >::deleter_type |
Definition at line 215 of file unique_ptr.h.
typedef T std::unique_ptr< T, D >::element_type |
Definition at line 213 of file unique_ptr.h.
typedef T* std::unique_ptr< T, D >::pointer |
Definition at line 214 of file unique_ptr.h.
std::unique_ptr< T, D >::unique_ptr | ( | pointer | p = 0 | ) | throw () [inline, explicit] |
Default constructor.
p | A pointer to the object to point to, if any. |
Definition at line 222 of file unique_ptr.h.
std::unique_ptr< T, D >::unique_ptr | ( | pointer | p, |
deleter_reference | d | ||
) | [inline] |
Constructs a unique_ptr using a specific deleter.
This unique_ptr now has ownership of the pointed-to object.
p | A pointer to the object to own. |
d | The deleter to use. |
Definition at line 232 of file unique_ptr.h.
std::unique_ptr< T, D >::unique_ptr | ( | zorba::internal::rv< unique_ptr< T, D > > & | p | ) | [inline] |
Constructs a unique_ptr from an existing unique_ptr.
Note that:
unique_ptr<int> a( new int(1) ); unique_ptr<int> b( a ); // compile-time error
Instead, you must use the move()
function:
unique_ptr<int> a( new int(1) ); unique_ptr<int> b( move(a) ); // ok now
p | The unique_ptr to move from. |
Definition at line 249 of file unique_ptr.h.
std::unique_ptr< T, D >::unique_ptr | ( | zorba::internal::rv< unique_ptr< U, E > > & | p, |
typename enable_if< ZORBA_TR1_NS::is_convertible< typename unique_ptr< U >::pointer, pointer >::value &&ZORBA_TR1_NS::is_convertible< E, D >::value &&(!ZORBA_TR1_NS::is_reference< D >::value||ZORBA_TR1_NS::is_same< D, E >::value) >::type * | = 0 |
||
) | [inline] |
Constructs a unique_ptr from an existing unique_ptr.
U | The pointed-to type such that U* is convertible to T* . |
E | The deleter such that E is convertible to D . |
p | The unique_ptr to move from. |
Definition at line 262 of file unique_ptr.h.
std::unique_ptr< T, D >::~unique_ptr | ( | ) | [inline] |
Destroys the pointed-to object by calling the deleter (if the pointer is not null).
Definition at line 280 of file unique_ptr.h.
pointer std::unique_ptr< T, D >::get | ( | ) | const throw () [inline] |
deleter_reference std::unique_ptr< T, D >::get_deleter | ( | ) | throw () [inline] |
deleter_const_reference std::unique_ptr< T, D >::get_deleter | ( | ) | const throw () [inline] |
std::unique_ptr< T, D >::operator explicit_bool | ( | ) | const throw () [inline] |
Conversion to bool
.
true
only if the pointer is not null; false
only if the pointer is null. Definition at line 411 of file unique_ptr.h.
element_type& std::unique_ptr< T, D >::operator* | ( | ) | const throw () [inline] |
Dereferences the pointer.
Definition at line 330 of file unique_ptr.h.
pointer std::unique_ptr< T, D >::operator-> | ( | ) | const throw () [inline] |
std::unique_ptr< T, D >::operator::zorba::internal::rv | ( | ) | throw () [inline] |
Definition at line 430 of file unique_ptr.h.
std::unique_ptr< T, D >::operator::zorba::internal::rv | ( | ) | const throw () [inline] |
Definition at line 434 of file unique_ptr.h.
unique_ptr& std::unique_ptr< T, D >::operator= | ( | zorba::internal::rv< unique_ptr< T, D > > & | p | ) | [inline] |
Destructive assignment: moves ownership of the object pointed-to by p to this unique_ptr.
The object pointed-to by this unique_ptr, if any, is deleted.
p | The unique_ptr to move from. |
*this
. Definition at line 292 of file unique_ptr.h.
unique_ptr& std::unique_ptr< T, D >::operator= | ( | zorba::internal::rv< unique_ptr< U, E > > & | p | ) | [inline] |
Destructive assignment: moves ownership of the object pointed-to by p to this unique_ptr.
The object pointed-to by this unique_ptr, if any, is deleted.
U | The pointed-to type such that U* is convertible to T* . |
E | The deleter of p. |
p | The unique_ptr to move from. |
*this
. Definition at line 309 of file unique_ptr.h.
unique_ptr& std::unique_ptr< T, D >::operator= | ( | int | ) | [inline] |
Assignment from null: equivalent to reset()
.
*this
. Definition at line 320 of file unique_ptr.h.
pointer std::unique_ptr< T, D >::release | ( | ) | throw () [inline] |
Releases ownership of the pointed-to object.
Said object will now be the responsibility of the caller.
Definition at line 376 of file unique_ptr.h.
void std::unique_ptr< T, D >::reset | ( | pointer | p = 0 | ) | throw () [inline] |
Sets the pointer to the given value or null if none.
The previosly pointed-to object, if any, is deleted. However, if p equals the current pointer value, then this function does nothing.
p | The new pointer value, if any. |
Definition at line 389 of file unique_ptr.h.
Referenced by std::unique_ptr< proxy_streambuf >::operator=(), and std::unique_ptr< T[], D >::operator=().
void std::unique_ptr< T, D >::swap | ( | unique_ptr< T, D > & | p | ) | [inline] |
Swaps the pointer and deleter with that of another unique_ptr.
p | The unique_ptr to swap with. |
Definition at line 401 of file unique_ptr.h.
Referenced by std::unique_ptr< proxy_streambuf >::swap(), std::unique_ptr< T[], D >::swap(), and std::swap().