CrystalSpace

Public API Reference

CS::Utility::ScopedArrayPointer< T > Class Template Reference

Smart pointer that delete[]s the contained pointer when the scope is exited. More...

#include <csutil/scopedpointer.h>

Inheritance diagram for CS::Utility::ScopedArrayPointer< T >:

List of all members.

Public Member Functions

T * Detach ()
 Detach underlying pointer, i.e.
void Invalidate ()
 Invalidate (delete) the contained pointer.
bool IsValid () const
 Check if the contained pointer is valid.
 operator T * () const
 Cast to a pointer.
T & operator* () const
 Dereference underlying pointer.
T * operator-> () const
 Dereference underlying pointer.
void Reset (T *ptr=nullptr)
 Replace the contained pointer to an array with another.
 ScopedArrayPointer (T *ptr=nullptr)
 Construct from given pointer to an array.
 ~ScopedArrayPointer ()
 Destruct. Deletes the given pointer!

Detailed Description

template<class T>
class CS::Utility::ScopedArrayPointer< T >

Smart pointer that delete[]s the contained pointer when the scope is exited.

Template Parameters:
T is the type pointed to.

Definition at line 92 of file scopedpointer.h.


Constructor & Destructor Documentation

template<class T >
CS::Utility::ScopedArrayPointer< T >::ScopedArrayPointer ( T *  ptr = nullptr  )  [inline]

Construct from given pointer to an array.

Remarks:
Takes ownership of ptr!

Definition at line 100 of file scopedpointer.h.

template<class T >
CS::Utility::ScopedArrayPointer< T >::~ScopedArrayPointer (  )  [inline]

Destruct. Deletes the given pointer!

Definition at line 102 of file scopedpointer.h.


Member Function Documentation

template<class T >
T* CS::Utility::ScopedArrayPointer< T >::Detach (  )  [inline]

Detach underlying pointer, i.e.

ownership is dropped, and the caller will have to delete the pointer.

Definition at line 134 of file scopedpointer.h.

template<class T >
void CS::Utility::ScopedArrayPointer< T >::Invalidate (  )  [inline]

Invalidate (delete) the contained pointer.

Definition at line 114 of file scopedpointer.h.

template<class T >
bool CS::Utility::ScopedArrayPointer< T >::IsValid (  )  const [inline]

Check if the contained pointer is valid.

Definition at line 116 of file scopedpointer.h.

template<class T >
CS::Utility::ScopedArrayPointer< T >::operator T * (  )  const [inline]

Cast to a pointer.

Definition at line 123 of file scopedpointer.h.

template<class T >
T& CS::Utility::ScopedArrayPointer< T >::operator* (  )  const [inline]

Dereference underlying pointer.

Definition at line 127 of file scopedpointer.h.

template<class T >
T* CS::Utility::ScopedArrayPointer< T >::operator-> (  )  const [inline]

Dereference underlying pointer.

Definition at line 119 of file scopedpointer.h.

template<class T >
void CS::Utility::ScopedArrayPointer< T >::Reset ( T *  ptr = nullptr  )  [inline]

Replace the contained pointer to an array with another.

Remarks:
Takes ownership of ptr!

Definition at line 108 of file scopedpointer.h.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1