SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::SmartPointer< T > Class Template Referenceabstract

#include <SmartPointer.hpp>

Inheritance diagram for Sleak::SmartPointer< T >:

Public Member Functions

 SmartPointer (const SmartPointer &)=delete
virtual ~SmartPointer ()
T * get () const
 Raw pointer access; throws NullPointerException if unset.
virtual bool IsValid () const
 True if the pointer is non-null.
 operator bool () const
T & operator* () const
T * operator-> () const
SmartPointeroperator= (const SmartPointer &)=delete
virtual void reset (T *newPtr=nullptr)=0

Protected Member Functions

 SmartPointer (T *p=nullptr)

Protected Attributes

T * ptr

Detailed Description

template<typename T>
class Sleak::SmartPointer< T >

Common base for RefPtr/ObjectPtr/WeakPtr: holds the raw pointer and the dereference/validity operators shared by every ownership model.

Definition at line 24 of file SmartPointer.hpp.

Constructor & Destructor Documentation

◆ SmartPointer() [1/2]

template<typename T>
Sleak::SmartPointer< T >::SmartPointer ( T * p = nullptr)
inlineexplicitprotected

Definition at line 29 of file SmartPointer.hpp.

◆ ~SmartPointer()

template<typename T>
virtual Sleak::SmartPointer< T >::~SmartPointer ( )
inlinevirtual

Definition at line 33 of file SmartPointer.hpp.

◆ SmartPointer() [2/2]

template<typename T>
Sleak::SmartPointer< T >::SmartPointer ( const SmartPointer< T > & )
delete

Member Function Documentation

◆ get()

template<typename T>
T * Sleak::SmartPointer< T >::get ( ) const
inline

Raw pointer access; throws NullPointerException if unset.

Definition at line 39 of file SmartPointer.hpp.

◆ IsValid()

template<typename T>
virtual bool Sleak::SmartPointer< T >::IsValid ( ) const
inlinevirtual

True if the pointer is non-null.

Definition at line 48 of file SmartPointer.hpp.

◆ operator bool()

template<typename T>
Sleak::SmartPointer< T >::operator bool ( ) const
inlineexplicit

Definition at line 56 of file SmartPointer.hpp.

◆ operator*()

template<typename T>
T & Sleak::SmartPointer< T >::operator* ( ) const
inline

Definition at line 36 of file SmartPointer.hpp.

◆ operator->()

template<typename T>
T * Sleak::SmartPointer< T >::operator-> ( ) const
inline

Definition at line 37 of file SmartPointer.hpp.

◆ operator=()

template<typename T>
SmartPointer & Sleak::SmartPointer< T >::operator= ( const SmartPointer< T > & )
delete

◆ reset()

Member Data Documentation

◆ ptr

template<typename T>
T* Sleak::SmartPointer< T >::ptr
protected

Definition at line 26 of file SmartPointer.hpp.