CS::Utility::ScopedPointer< T > Class Template Reference
Smart pointer that deletes the contained pointer when the scope is exited. More...
#include <csutil/scopedpointer.h>

Public Member Functions | |
| 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 with another. | |
| ScopedPointer (T *ptr=nullptr) | |
| Construct from given pointer. | |
| ~ScopedPointer () | |
| Destruct. Deletes the given pointer! | |
Detailed Description
template<class T>
class CS::Utility::ScopedPointer< T >
Smart pointer that deletes the contained pointer when the scope is exited.
- Template Parameters:
-
T is the type pointed to.
Definition at line 37 of file scopedpointer.h.
Constructor & Destructor Documentation
| CS::Utility::ScopedPointer< T >::ScopedPointer | ( | T * | ptr = nullptr |
) | [inline] |
Construct from given pointer.
- Remarks:
- Takes ownership of ptr!
Definition at line 45 of file scopedpointer.h.
| CS::Utility::ScopedPointer< T >::~ScopedPointer | ( | ) | [inline] |
Destruct. Deletes the given pointer!
Definition at line 47 of file scopedpointer.h.
Member Function Documentation
| void CS::Utility::ScopedPointer< T >::Invalidate | ( | ) | [inline] |
Invalidate (delete) the contained pointer.
Definition at line 59 of file scopedpointer.h.
| bool CS::Utility::ScopedPointer< T >::IsValid | ( | ) | const [inline] |
Check if the contained pointer is valid.
Definition at line 61 of file scopedpointer.h.
| CS::Utility::ScopedPointer< T >::operator T * | ( | ) | const [inline] |
Cast to a pointer.
Definition at line 68 of file scopedpointer.h.
| T& CS::Utility::ScopedPointer< T >::operator* | ( | ) | const [inline] |
Dereference underlying pointer.
Definition at line 72 of file scopedpointer.h.
| T* CS::Utility::ScopedPointer< T >::operator-> | ( | ) | const [inline] |
Dereference underlying pointer.
Definition at line 64 of file scopedpointer.h.
| void CS::Utility::ScopedPointer< T >::Reset | ( | T * | ptr = nullptr |
) | [inline] |
Replace the contained pointer with another.
- Remarks:
- Takes ownership of ptr!
Definition at line 53 of file scopedpointer.h.
The documentation for this class was generated from the following file:
- csutil/scopedpointer.h
Generated for Crystal Space 2.1 by doxygen 1.6.1
