GL Studio C++ Runtime API
ScopedPtr< T > Class Template Reference

#include <scoped_ptr.h>

Public Member Functions

 ScopedPtr (T *p=NULL)
 
 ScopedPtr (ScopedPtr &&that)
 
ScopedPtroperator= (ScopedPtr &&that)
 
T & operator* () const
 
T * operator-> () const
 
void Reset (T *p=NULL)
 
bool IsNull () const
 
T * Get () const
 

Detailed Description

template<class T>
class disti::ScopedPtr< T >

The ScopedPtr class template stores a pointer to a dynamically allocated object. The object pointed to is guaranteed to be deleted, either on destruction of the ScopedPtr or via an explicit Reset.

Constructor & Destructor Documentation

◆ ScopedPtr() [1/2]

ScopedPtr ( T *  p = NULL)
inlineexplicit

Constructor

Parameters
pThe pointer to wrap with this object.

◆ ScopedPtr() [2/2]

ScopedPtr ( ScopedPtr< T > &&  that)
inline

Move constructor

Parameters
thatThe object to move from.

Member Function Documentation

◆ Get()

T * Get ( ) const
inline
Returns
The underlying pointer.

◆ IsNull()

bool IsNull ( ) const
inline
Returns
True if the underlying pointer isn't NULL.

◆ operator*()

T & operator* ( ) const
inline

Address operator

Returns
The address of the underlying pointer.

◆ operator->()

T * operator-> ( ) const
inline

Dereference operator

Returns
The underlying pointer.

◆ operator=()

ScopedPtr & operator= ( ScopedPtr< T > &&  that)
inline

Move assignment operator

Parameters
thatThe object to move from.
Returns
The resulting object (this).

◆ Reset()

void Reset ( T *  p = NULL)
inline

Reset the object by deleting the old object, and assigning a new one.

Parameters
pThe new underlying pointer to assign.

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