CS::Utility::ScopedPointer< T > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
CS::Utility::ScopedPointer< T > Class Template Reference

Smart pointer that deletes the contained pointer when the scope is exited. More...

`#include <csutil/scopedpointer.h>`

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

List of all members.

## 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

template<class T >

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.

template<class T >

CS::Utility::ScopedPointer< T >::~ScopedPointer | ( |  | ) | `[inline]`

Destruct. Deletes the given pointer!

Definition at line 47 of file scopedpointer.h.

## Member Function Documentation

template<class T >

void CS::Utility::ScopedPointer< T >::Invalidate | ( |  | ) | `[inline]`

Invalidate (delete) the contained pointer.

Definition at line 59 of file scopedpointer.h.

template<class T >

bool CS::Utility::ScopedPointer< T >::IsValid | ( |  | ) | const`[inline]`

Check if the contained pointer is valid.

Definition at line 61 of file scopedpointer.h.

template<class T >

CS::Utility::ScopedPointer< T >::operator T * | ( |  | ) | const`[inline]`

Cast to a pointer.

Definition at line 68 of file scopedpointer.h.

template<class T >

T& CS::Utility::ScopedPointer< T >::operator* | ( |  | ) | const`[inline]`

Dereference underlying pointer.

Definition at line 72 of file scopedpointer.h.

template<class T >

T* CS::Utility::ScopedPointer< T >::operator-> | ( |  | ) | const`[inline]`

Dereference underlying pointer.

Definition at line 64 of file scopedpointer.h.

template<class T >

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