|
template<l61Obj T, l61Obj Ty> |
bool | instanceof (const Ty &value) |
| Checks if a value is an instance of type T (or derived from T).
|
template<l61Obj T, l61Obj Ty> |
bool | exact_instanceof (const Ty &value) |
| Checks if a value is exactly of type T.
|
template<l61Obj T, l61Obj Ty> |
constexpr bool | static_instanceof (const Ty &) |
| Checks if a value is an instance of type T (or derived from T) at compile-time.
|
template<typename cast_type, typename obj_type, typename T = obj_type, typename Tx = std::conditional_t<std::is_pointer_v<cast_type>, cast_type, std::add_pointer_t<cast_type>>> |
__inline constexpr Tx | dyn_cast (obj_type obj) |
template<typename T> |
__inline constexpr T | dyn_cast (std::nullptr_t) |
template<l61Obj T, l61Obj Ty>
bool l61::meta::exact_instanceof |
( |
const Ty & | value | ) |
|
Checks if a value is exactly of type T.
Compares the runtime type of the object with T using typeid. Returns true only if the object is exactly of type T, not a derived type.
- Template Parameters
-
T | The type to check against. |
Ty | The type of the object being tested. |
- Parameters
-
value | The object to check. |
- Returns
- true if value is exactly of type T, false otherwise.
- Note
- Requires RTTI to be enabled.
template<l61Obj T, l61Obj Ty>
bool l61::meta::instanceof |
( |
const Ty & | value | ) |
|
Checks if a value is an instance of type T (or derived from T).
Uses dynamic_cast to determine whether the provided object can be safely cast to type T, meaning it is either of type T or derived from T.
- Template Parameters
-
T | The target type to check against. |
Ty | The type of the object being tested. |
- Parameters
-
value | The object to check. |
- Returns
- true if value is an instance of T or derived from T, false otherwise.
- Note
- Requires RTTI to be enabled.