Evo C++ Library v0.5.1
Public Types | Public Member Functions | Public Attributes | List of all members
PtrBase< T, P > Struct Template Reference

#include <evo/type.h>

Inheritance diagram for PtrBase< T, P >:
Inheritance graph
[legend]

Detailed Description

template<class T, class P = T*>
struct evo::PtrBase< T, P >

Base managed pointer.

Template Parameters
TType to use pointer to (not raw pointer type)
PActual pointer to store – usually T* but could be something compatible like Atomic<T*>

Public Types

typedef PtrBase< T, P > Base
 This pointer base type. More...
 
typedef void EvoNullableType
 Identify as nullable type. More...
 

Public Member Functions

bool null () const
 Get whether pointer is null. More...
 
 operator SafeBoolType () const
 Safe (explicit) evaluation as bool type. More...
 
bool operator! () const
 Negation operator checks if NULL. More...
 
bool operator!= (const Base &ptr) const
 Inequality operator. More...
 
bool operator!= (void *ptr) const
 Inequality operator. More...
 
const T & operator* () const
 Dereference operator (const). More...
 
T & operator* ()
 Dereference operator (mutable). More...
 
const T * operator-> () const
 Member access operator (const). More...
 
T * operator-> ()
 Member access operator (mutable). More...
 
bool operator< (const Base &ptr) const
 Less-than operator. More...
 
bool operator< (void *ptr) const
 Less-than operator. More...
 
bool operator<= (const Base &ptr) const
 Less-than-or-equals operator. More...
 
bool operator<= (void *ptr) const
 Less-than-or-equals operator. More...
 
bool operator== (const Base &ptr) const
 Equality operator. More...
 
bool operator== (void *ptr) const
 Equality operator. More...
 
bool operator> (const Base &ptr) const
 Greater-than operator. More...
 
bool operator> (void *ptr) const
 Greater-than operator. More...
 
bool operator>= (const Base &ptr) const
 Greater-than-or-equals operator. More...
 
bool operator>= (void *ptr) const
 Greater-than-or-equals operator. More...
 
const T & operator[] (ulong index) const
 Array access operator (const). More...
 
T & operator[] (ulong index)
 Array access operator (mutable). More...
 
const T * ptr () const
 Get current pointer (const). More...
 
T * ptr ()
 Get current pointer (mutable). More...
 
bool valid () const
 Get whether pointer is valid (not null). More...
 

Public Attributes

ptr_
 Pointer. More...
 

Member Typedef Documentation

◆ Base

typedef PtrBase<T,P> Base

This pointer base type.

◆ EvoNullableType

typedef void EvoNullableType

Identify as nullable type.

Member Function Documentation

◆ null()

bool null ( ) const
inline

Get whether pointer is null.

Returns
Whether null

◆ operator SafeBoolType()

operator SafeBoolType ( ) const
inlineinherited

Safe (explicit) evaluation as bool type.

  • This is called when object is directly evaluated as a bool, and is equivalent to: !operator!()
  • See SafeBool

◆ operator!()

bool operator! ( ) const
inline

Negation operator checks if NULL.

Returns
Whether NULL

◆ operator!=() [1/2]

bool operator!= ( const Base ptr) const
inline

Inequality operator.

Parameters
ptrPointer to compare to
Returns
Whether not equal

◆ operator!=() [2/2]

bool operator!= ( void *  ptr) const
inline

Inequality operator.

Parameters
ptrPointer to compare to
Returns
Whether not equal

◆ operator*() [1/2]

const T& operator* ( ) const
inline

Dereference operator (const).

  • Results are undefined if pointer is NULL
Returns
Dereferenced pointer

◆ operator*() [2/2]

T& operator* ( )
inline

Dereference operator (mutable).

  • Results are undefined if pointer is NULL
Returns
Dereferenced pointer

◆ operator->() [1/2]

const T* operator-> ( ) const
inline

Member access operator (const).

  • Results are undefined if pointer is NULL
Returns
Pointer

◆ operator->() [2/2]

T* operator-> ( )
inline

Member access operator (mutable).

  • Results are undefined if pointer is NULL
Returns
Pointer

◆ operator<() [1/2]

bool operator< ( const Base ptr) const
inline

Less-than operator.

Parameters
ptrPointer to compare to
Returns
Whether less than ptr

◆ operator<() [2/2]

bool operator< ( void *  ptr) const
inline

Less-than operator.

Parameters
ptrPointer to compare to
Returns
Whether less than ptr

◆ operator<=() [1/2]

bool operator<= ( const Base ptr) const
inline

Less-than-or-equals operator.

Parameters
ptrPointer to compare to
Returns
Whether less than or equal to ptr

◆ operator<=() [2/2]

bool operator<= ( void *  ptr) const
inline

Less-than-or-equals operator.

Parameters
ptrPointer to compare to
Returns
Whether less than or equal to ptr

◆ operator==() [1/2]

bool operator== ( const Base ptr) const
inline

Equality operator.

Parameters
ptrPointer to compare to
Returns
Whether equal

◆ operator==() [2/2]

bool operator== ( void *  ptr) const
inline

Equality operator.

Parameters
ptrPointer to compare to
Returns
Whether equal

◆ operator>() [1/2]

bool operator> ( const Base ptr) const
inline

Greater-than operator.

Parameters
ptrPointer to compare to
Returns
Whether greater than ptr

◆ operator>() [2/2]

bool operator> ( void *  ptr) const
inline

Greater-than operator.

Parameters
ptrPointer to compare to
Returns
Whether greater than ptr

◆ operator>=() [1/2]

bool operator>= ( const Base ptr) const
inline

Greater-than-or-equals operator.

Parameters
ptrPointer to compare to
Returns
Whether greater than or equal to ptr

◆ operator>=() [2/2]

bool operator>= ( void *  ptr) const
inline

Greater-than-or-equals operator.

Parameters
ptrPointer to compare to
Returns
Whether greater than or equal to ptr

◆ operator[]() [1/2]

const T& operator[] ( ulong  index) const
inline

Array access operator (const).

  • Results are undefined if pointer is NULL or index is out of bounds
Returns
Item reference

◆ operator[]() [2/2]

T& operator[] ( ulong  index)
inline

Array access operator (mutable).

  • Results are undefined if pointer is NULL or index is out of bounds
Returns
Item reference

◆ ptr() [1/2]

const T* ptr ( ) const
inline

Get current pointer (const).

  • Caution: This does not release ownership of the pointer
Returns
Current pointer, or NULL if none

◆ ptr() [2/2]

T* ptr ( )
inline

Get current pointer (mutable).

  • Caution: This does not release ownership of the pointer
Returns
Current pointer, or NULL if none

◆ valid()

bool valid ( ) const
inline

Get whether pointer is valid (not null).

Returns
Whether valid

Member Data Documentation

◆ ptr_

P ptr_

Pointer.


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