![]() |
Raven Engine v0.1
|
CRTP base class enabling self-casting in derived types. More...
#include <Casting.h>
Public Member Functions | |
| template<typename T> requires std::derived_from<T, Derived> | |
| T & | As () |
| Non-const version of As<T>(), for casting to a non-const target type. | |
| template<typename T> requires std::derived_from<T, Derived> | |
| const T & | As () const |
| Const version of As<T>(), for casting to a const target type. | |
CRTP base class enabling self-casting in derived types.
This class provides the As<T>() method for derived classes, enabling safe casting within a CRTP hierarchy.
Typical usage:
| Derived | The derived class using this CRTP base class. |
|
inline |
Non-const version of As<T>(), for casting to a non-const target type.
This method is used for casting a Derived type to another type T, and allows modification of the casted object.
| T | The target type to cast to. |
|
inline |
Const version of As<T>(), for casting to a const target type.
This method is used for casting a Derived type to another type T, and ensures the casted object remains constant.
| T | The target type to cast to. |