class Gambit::safe_ptr

[No description available] More…

#include <util_types.hpp>

Inherited by Gambit::omp_safe_ptr< TYPE >

Public Functions

Name
safe_ptr(TYPE * in_ptr =NULL)
Construct-o-safe_ptr.
virtual voidset(TYPE * in_ptr)
Set pointer.
virtual const TYPE &operator*() const
Dereference pointer.
virtual const TYPE &operator[](int index) const
Dereference pointer as if it is an array.
virtual const TYPE *operator->() const
Access is allowed to const member functions only.
virtual boolisNull() const

Protected Functions

Name
voiddieGracefully()
Failure message invoked when the user tries to dereference a null safe_ptr.

Protected Attributes

Name
const TYPE *ptr
The actual underlying pointer, interpreted as a pointer to constant value.

Detailed Description

template <typename TYPE >
class Gambit::safe_ptr;

A safe pointer that throws an informative error if you try to dereference it when nullified, and cannot be used to overwrite the thing it points to.

Public Functions Documentation

function safe_ptr

inline safe_ptr(
    TYPE * in_ptr =NULL
)

Construct-o-safe_ptr.

function set

inline virtual void set(
    TYPE * in_ptr
)

Set pointer.

function operator*

inline virtual const TYPE & operator*() const

Dereference pointer.

Reimplemented by: Gambit::omp_safe_ptr::operator*

function operator[]

inline virtual const TYPE & operator[](
    int index
) const

Dereference pointer as if it is an array.

function operator->

inline virtual const TYPE * operator->() const

Access is allowed to const member functions only.

function isNull

inline virtual bool isNull() const

Protected Functions Documentation

function dieGracefully

static inline void dieGracefully()

Failure message invoked when the user tries to dereference a null safe_ptr.

Protected Attributes Documentation

variable ptr

const TYPE * ptr;

The actual underlying pointer, interpreted as a pointer to constant value.


Updated on 2024-07-18 at 13:53:30 +0000