#include <rtti/objectptr.h>
Public Member Functions | |
ObjectPtr ()=default | |
virtual | ~ObjectPtr () override |
ObjectPtr (T *ptr) | |
ObjectPtr (const ObjectPtr< T > &other) | |
ObjectPtr (ObjectPtr< T > &&other) | |
ObjectPtr< T > & | operator= (const ObjectPtr< T > &other) |
ObjectPtr< T > & | operator= (ObjectPtr< T > &&other) |
T * | get () const |
T * | get () |
template<typename OTHER > | |
ObjectPtr (const ObjectPtr< OTHER > &other) | |
template<typename OTHER > | |
ObjectPtr (ObjectPtr< OTHER > &&other) | |
template<typename OTHER > | |
ObjectPtr< T > & | operator= (const ObjectPtr< OTHER > &other) |
template<typename OTHER > | |
ObjectPtr< T > & | operator= (ObjectPtr< OTHER > &&other) |
const T & | operator* () const |
T & | operator* () |
T * | operator-> () const |
T * | operator-> () |
bool | operator== (const ObjectPtr< T > &other) const |
template<typename OTHER > | |
bool | operator== (const ObjectPtr< OTHER > &other) const |
template<typename OTHER > | |
bool | operator== (const OTHER *ptr) const |
bool | operator== (std::nullptr_t) const |
bool | operator!= (const ObjectPtr< T > &other) const |
template<typename OTHER > | |
bool | operator!= (const ObjectPtr< OTHER > &other) const |
template<typename OTHER > | |
bool | operator!= (const OTHER *ptr) const |
bool | operator!= (std::nullptr_t) const |
bool | operator< (const ObjectPtr< T > &other) const |
bool | operator> (const ObjectPtr< T > &other) const |
bool | operator<= (const ObjectPtr< T > &other) const |
bool | operator>= (const ObjectPtr< T > &other) const |
![]() | |
virtual | ~ObjectPtrBase ()=default |
rttr::type | getWrappedType () const |
Acts like a regular pointer. Accessing the pointer does not have different performance characteristics than accessing a regular pointer. Moving/copying an ObjectPtr has a small overhead, as it removes/adds itself from the ObjectPtrManager in such cases.
The purpose of ObjectPtr is that the internal pointer can be changed by the system. Therefore it is not allowed to store the internal pointer or a reference to the internal pointer, as it may get replaced (and destructed) by the system. This occurs when hot reloading changes into the running application.
When creating resources at runtime that require a link to another rtti::Object, it is perfectly safe (and valid) to create the referenced object and wrap it in an ObjectPtr<T>, before assigning it. In that case you do have to manually manage the lifetime of the created objects.
|
default |
|
overridevirtual |
ObjectPtr | ( | T * | ptr | ) |
T* get | ( | ) |
T* get | ( | ) | const |
bool operator!= | ( | const ObjectPtr< OTHER > & | other | ) | const |
bool operator!= | ( | const ObjectPtr< T > & | other | ) | const |
bool operator!= | ( | const OTHER * | ptr | ) | const |
bool operator!= | ( | std::nullptr_t | ) | const |
T& operator* | ( | ) |
const T& operator* | ( | ) | const |
T* operator-> | ( | ) |
T* operator-> | ( | ) | const |
bool operator< | ( | const ObjectPtr< T > & | other | ) | const |
bool operator<= | ( | const ObjectPtr< T > & | other | ) | const |
bool operator== | ( | const ObjectPtr< OTHER > & | other | ) | const |
bool operator== | ( | const ObjectPtr< T > & | other | ) | const |
bool operator== | ( | const OTHER * | ptr | ) | const |
bool operator== | ( | std::nullptr_t | ) | const |
bool operator> | ( | const ObjectPtr< T > & | other | ) | const |
bool operator>= | ( | const ObjectPtr< T > & | other | ) | const |