#include <core/reflection/reflect.hpp>
template<typename T>
Reflect struct
Defines the reflection function for the given type T
.
Template parameters | |
---|---|
T | Type to reflect. |
By default, this function calls the static member function reflect
of the type, which should return a pointer to an instance of Type.
To implement reflection for your type, you should either:
- Define a static member function
reflect
with return typeconst Type&
on your type. - Specialize this struct for your type.
The first option is preferred, as it is less verbose. However, when handling external types, to which member functions cannot be added, the second option is necessary.
Both options can and should be shortened by using the macros:
- CUBOS_
REFLECT - declaring the reflection member functions. - CUBOS_
REFLECT_ IMPL - defining the reflection member functions. - CUBOS_
REFLECT_ EXTERNAL_ DECL - declaring the reflection specialization. - CUBOS_
REFLECT_ EXTERNAL_ IMPL - defining the reflection specialization's functions.