Classes | Public Types | Public Member Functions
std::unique_ptr Class Reference

#include <zorba/internal/unique_ptr.h>

Inheritance diagram for std::unique_ptr:
Inheritance graph
[legend]

List of all members.

Classes

struct  pointer_conversion

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_typeoperator* () const throw ()
 Dereferences the pointer.
pointer operator-> () const throw ()
 Gets the pointer.
 operator::zorba::internal::rv () throw ()
 operator::zorba::internal::rv () const throw ()
unique_ptroperator= (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_ptroperator= (zorba::internal::rv< unique_ptr< U, E > > &p)
 Destructive assignment: moves ownership of the object pointed-to by p to this unique_ptr.
unique_ptroperator= (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).

Member Typedef Documentation

Definition at line 202 of file unique_ptr.h.

Definition at line 200 of file unique_ptr.h.

Definition at line 201 of file unique_ptr.h.


Constructor & Destructor Documentation

std::unique_ptr::unique_ptr ( pointer  p = 0) throw () [inline, explicit]

Default constructor.

Parameters:
pA pointer to the object to point to, if any.

Definition at line 209 of file unique_ptr.h.

std::unique_ptr::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.

Parameters:
pA pointer to the object to own.
dThe deleter to use.

Definition at line 219 of file unique_ptr.h.

std::unique_ptr::unique_ptr ( zorba::internal::rv< unique_ptr > &  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
Parameters:
pThe unique_ptr to move from.

Definition at line 236 of file unique_ptr.h.

template<typename U , typename E >
std::unique_ptr::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.

Template Parameters:
UThe pointed-to type such that U* is convertible to T*.
EThe deleter such that E is convertible to D.
Parameters:
pThe unique_ptr to move from.

Definition at line 249 of file unique_ptr.h.

std::unique_ptr::~unique_ptr ( ) [inline]

Destroys the pointed-to object by calling the deleter (if the pointer is not null).

Definition at line 267 of file unique_ptr.h.


Member Function Documentation

pointer std::unique_ptr::get ( ) const throw () [inline]

Gets the pointer.

Returns:
Returns said pointer.

Definition at line 335 of file unique_ptr.h.

deleter_reference std::unique_ptr::get_deleter ( ) throw () [inline]

Gets the deleter in use.

Returns:
Returns said deleter.

Definition at line 344 of file unique_ptr.h.

deleter_const_reference std::unique_ptr::get_deleter ( ) const throw () [inline]

Gets the deleter in use.

Returns:
Returns said deleter.

Definition at line 353 of file unique_ptr.h.

std::unique_ptr::operator explicit_bool ( ) const throw () [inline]

Conversion to bool.

Returns:
Returns true only if the pointer is not null; false only if the pointer is null.

Definition at line 398 of file unique_ptr.h.

element_type& std::unique_ptr::operator* ( ) const throw () [inline]

Dereferences the pointer.

Returns:
Returns a reference to the pointed-to object.

Definition at line 317 of file unique_ptr.h.

pointer std::unique_ptr::operator-> ( ) const throw () [inline]

Gets the pointer.

Returns:
Returns said pointer.

Definition at line 326 of file unique_ptr.h.

std::unique_ptr::operator::zorba::internal::rv ( ) throw () [inline]

Definition at line 417 of file unique_ptr.h.

std::unique_ptr::operator::zorba::internal::rv ( ) const throw () [inline]

Definition at line 421 of file unique_ptr.h.

unique_ptr& std::unique_ptr::operator= ( zorba::internal::rv< unique_ptr > &  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.

Parameters:
pThe unique_ptr to move from.
Returns:
Returns *this.

Definition at line 279 of file unique_ptr.h.

template<typename U , typename E >
unique_ptr& std::unique_ptr::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.

Template Parameters:
UThe pointed-to type such that U* is convertible to T*.
EThe deleter of p.
Parameters:
pThe unique_ptr to move from.
Returns:
Returns *this.

Definition at line 296 of file unique_ptr.h.

unique_ptr& std::unique_ptr::operator= ( int  ) [inline]

Assignment from null: equivalent to reset().

Returns:
Returns *this.

Definition at line 307 of file unique_ptr.h.

pointer std::unique_ptr::release ( ) throw () [inline]

Releases ownership of the pointed-to object.

Said object will now be the responsibility of the caller.

Returns:
Returns a pointer to the object.

Definition at line 363 of file unique_ptr.h.

void std::unique_ptr::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.

Parameters:
pThe new pointer value, if any.

Definition at line 376 of file unique_ptr.h.

Referenced by std::unique_ptr< iterator >::operator=().

void std::unique_ptr::swap ( unique_ptr p) [inline]

Swaps the pointer and deleter with that of another unique_ptr.

Parameters:
pThe unique_ptr to swap with.

Definition at line 388 of file unique_ptr.h.

Referenced by std::unique_ptr< iterator >::swap().


The documentation for this class was generated from the following file:
blog comments powered by Disqus