AutoPtr< T > Class Template Reference

#include <Pt/Cosmo/AutoPtr.h>

Owning smart pointer. More...

Public Member Functions

 AutoPtr ()
 Default constructor.
 
template<typename Y >
 AutoPtr (Y *ptr)
 Constructor.
 
template<typename Y , typename Deleter >
 AutoPtr (Y *ptr, Deleter deleter)
 Constructor.
 
 AutoPtr (AutoPtrRef< T > rhs)
 Copy constructor (C++03 move via AutoPtrRef).
 
 AutoPtr (AutoPtr &&other)
 Move constructor.
 
 ~AutoPtr ()
 Destructor.
 
AutoPtroperator= (AutoPtr &&other)
 Move assignment operator.
 
AutoPtroperator= (AutoPtrRef< T > rhs)
 Assignment operator (C++03 move via AutoPtrRef).
 
template<class Y >
 operator AutoPtrRef< Y > ()
 Conversion operator used for assignments.
 
T * get () const
 Access value.
 
T & operator* () const
 Access value.
 
T * operator-> () const
 Access value.
 
bool operator! () const
 Returns true if nullptr.
 
 operator bool () const
 Returns true if valid pointer.
 
T * release ()
 Release ownership.
 
void reset ()
 Reset value.
 
template<typename Y >
void reset (Y *ptr)
 Reset value.
 

Related Functions

template<typename T >
AutoPtr< T > move (AutoPtr< T > &p)
 Move to other instance.
 
template<typename T , typename Y >
bool operator== (const AutoPtr< T > &a, const AutoPtr< Y > &b)
 Equality comparison operator.
 
template<typename T , typename Y >
bool operator== (const AutoPtr< T > &a, const Y *b)
 Equality comparison operator.
 
template<typename T , typename Y >
bool operator!= (const AutoPtr< T > &a, const AutoPtr< Y > &b)
 Equality comparison operator.
 
template<typename T , typename Y >
bool operator!= (const AutoPtr< T > &a, const Y *b)
 Equality comparison operator.
 
template<typename T , typename Y >
bool operator< (const AutoPtr< T > &a, const AutoPtr< Y > &b)
 Less-than comparison operator.
 
template<typename T , typename Y >
bool operator< (const AutoPtr< T > &a, const Y *b)
 Less-than comparison operator.
 

Detailed Description

template<typename T>
class Pt::Cosmo::AutoPtr< T >

Manages the lifetime of a dynamically allocated object using a configurable deleter. Supports move semantics but not copying.