Honeycomb  0.1
Component-Model Framework
Classes | Public Types | Public Member Functions | Friends | Related Functions | List of all members
honey::UniquePtr< T, Fin > Class Template Reference

Pointer to a unique, non-shared, object. Finalizer is run upon destruction (deletes object by default) if pointer is not null. More...

#include <SharedPtr.h>

Inheritance diagram for honey::UniquePtr< T, Fin >:
Inheritance graph
[legend]
Collaboration diagram for honey::UniquePtr< T, Fin >:
Collaboration graph
[legend]

Public Types

typedef Elem_< T >::type Elem
 
typedef Ref_< Elem >::type Ref
 
typedef ElemPtr
 

Public Member Functions

 UniquePtr ()
 
 UniquePtr (nullptr_t)
 
template<class Fin_ = Fin>
 UniquePtr (Ptr ptr, Fin_ &&f=Fin_())
 
 UniquePtr (UniquePtr &&rhs) noexcept
 Moves pointer and finalizer out of rhs. To set a new finalizer into rhs use move assign: rhs = UniquePtr(p,f);. More...
 
template<class U , class F >
 UniquePtr (UniquePtr< U, F > &&rhs)
 
 ~UniquePtr ()
 
UniquePtroperator= (UniquePtr &&rhs)
 Moves pointer and finalizer out of rhs. More...
 
template<class U , class F >
UniquePtroperator= (UniquePtr< U, F > &&rhs)
 
template<class U , class F >
bool operator== (const UniquePtr< U, F > &rhs) const
 
template<class U , class F >
bool operator!= (const UniquePtr< U, F > &rhs) const
 
template<class U , class F >
bool operator< (const UniquePtr< U, F > &rhs) const
 
template<class U , class F >
bool operator> (const UniquePtr< U, F > &rhs) const
 
template<class U , class F >
bool operator<= (const UniquePtr< U, F > &rhs) const
 
template<class U , class F >
bool operator>= (const UniquePtr< U, F > &rhs) const
 
Ptr operator-> () const
 
Ref operator* () const
 
 operator Ptr () const
 
Ptr get () const
 Get the raw pointer to the object. More...
 
Fin & finalizer ()
 Get the finalizer. More...
 
const Fin & finalizer () const
 
Ptr release ()
 Give up ownership of pointer without finalizing and set to null. More...
 
void set (Ptr p)
 Finalize old pointer and assign new. Does not finalize if old pointer is the same or null. More...
 

Friends

template<class , class >
class UniquePtr
 

Related Functions

(Note that these are not member functions.)

template<class T , class Alloc , class... Args, class Fin = finalize<T,typename mt::removeRef<Alloc>::type>>
UniquePtr< T, Fin > alloc_unique (Alloc &&a, Args &&...args)
 Create a unique ptr to an object of type T constructed with args. More...
 
template<class T , class... Args, typename mt::disable_if< std::is_array< T >::value, int >::type = 0, class Alloc = typename DefaultAllocator<T>::type>
UniquePtr< T > make_unique (Args &&...args)
 alloc_unique() using T::Allocator if available, otherwise std::allocator More...
 
template<class T , class... Args, typename std::enable_if< std::is_array< T >::value, int >::type = 0>
UniquePtr< T > make_unique (szt size)
 Create a unique ptr to an array of size number of elements. More...
 
template<class T , class... Args, typename std::enable_if< std::is_array< T >::value, int >::type = 0>
UniquePtr< T > make_unique_auto_size (Args &&...args)
 Create a unique ptr to an array with deduced size. More...
 

Detailed Description

template<class T, class Fin = finalize<T>>
class honey::UniquePtr< T, Fin >

Pointer to a unique, non-shared, object. Finalizer is run upon destruction (deletes object by default) if pointer is not null.

Member Typedef Documentation

template<class T, class Fin = finalize<T>>
typedef Elem_<T>::type honey::UniquePtr< T, Fin >::Elem
template<class T, class Fin = finalize<T>>
typedef Elem* honey::UniquePtr< T, Fin >::Ptr
template<class T, class Fin = finalize<T>>
typedef Ref_<Elem>::type honey::UniquePtr< T, Fin >::Ref

Constructor & Destructor Documentation

template<class T, class Fin = finalize<T>>
honey::UniquePtr< T, Fin >::UniquePtr ( )
inline
template<class T, class Fin = finalize<T>>
honey::UniquePtr< T, Fin >::UniquePtr ( nullptr_t  )
inline
template<class T, class Fin = finalize<T>>
template<class Fin_ = Fin>
honey::UniquePtr< T, Fin >::UniquePtr ( Ptr  ptr,
Fin_ &&  f = Fin_() 
)
inlineexplicit
template<class T, class Fin = finalize<T>>
honey::UniquePtr< T, Fin >::UniquePtr ( UniquePtr< T, Fin > &&  rhs)
inlinenoexcept

Moves pointer and finalizer out of rhs. To set a new finalizer into rhs use move assign: rhs = UniquePtr(p,f);.

template<class T, class Fin = finalize<T>>
template<class U , class F >
honey::UniquePtr< T, Fin >::UniquePtr ( UniquePtr< U, F > &&  rhs)
inline
template<class T, class Fin = finalize<T>>
honey::UniquePtr< T, Fin >::~UniquePtr ( )
inline

Member Function Documentation

template<class T, class Fin = finalize<T>>
Fin& honey::UniquePtr< T, Fin >::finalizer ( )
inline

Get the finalizer.

template<class T, class Fin = finalize<T>>
const Fin& honey::UniquePtr< T, Fin >::finalizer ( ) const
inline
template<class T, class Fin = finalize<T>>
Ptr honey::UniquePtr< T, Fin >::get ( ) const
inline

Get the raw pointer to the object.

template<class T, class Fin = finalize<T>>
honey::UniquePtr< T, Fin >::operator Ptr ( ) const
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator!= ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
Ref honey::UniquePtr< T, Fin >::operator* ( ) const
inline
template<class T, class Fin = finalize<T>>
Ptr honey::UniquePtr< T, Fin >::operator-> ( ) const
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator< ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator<= ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
UniquePtr& honey::UniquePtr< T, Fin >::operator= ( UniquePtr< T, Fin > &&  rhs)
inline

Moves pointer and finalizer out of rhs.

template<class T, class Fin = finalize<T>>
template<class U , class F >
UniquePtr& honey::UniquePtr< T, Fin >::operator= ( UniquePtr< U, F > &&  rhs)
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator== ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator> ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
template<class U , class F >
bool honey::UniquePtr< T, Fin >::operator>= ( const UniquePtr< U, F > &  rhs) const
inline
template<class T, class Fin = finalize<T>>
Ptr honey::UniquePtr< T, Fin >::release ( )
inline

Give up ownership of pointer without finalizing and set to null.

template<class T, class Fin = finalize<T>>
void honey::UniquePtr< T, Fin >::set ( Ptr  p)
inline

Finalize old pointer and assign new. Does not finalize if old pointer is the same or null.

Friends And Related Function Documentation

template<class T, class Fin = finalize<T>>
template<class , class >
friend class UniquePtr
friend

The documentation for this class was generated from the following files: