λ61
Loading...
Searching...
No Matches
l61::meta Namespace Reference

Namespaces

namespace  nulling

Classes

struct  is_eventBus_freq_compatible
struct  null_t
class  NullableMark

Concepts

concept  l61Obj
concept  l61ObjPtr
concept  eventBusFrequencyCompatible
concept  extensionEntryPointCompatible
concept  isNullableType
concept  castToZeroCompatible
concept  canStoreBytesOf
concept  safeCanStoreBytesOf
concept  stdHashCompatible
concept  l61CompatibleScriptDebugger
concept  CppObject

Functions

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)

Variables

template<typename T>
constexpr bool is_eventBus_freq_compatible_v = is_eventBus_freq_compatible<T>::value
template<typename>
constexpr bool always_false = false
template<typename>
constexpr bool always_true = true
constexpr nulling::null_t null

Function Documentation

◆ dyn_cast() [1/2]

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 l61::meta::dyn_cast ( obj_type obj)
constexpr

◆ dyn_cast() [2/2]

template<typename T>
__inline constexpr T l61::meta::dyn_cast ( std::nullptr_t )
constexpr

◆ exact_instanceof()

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
TThe type to check against.
TyThe type of the object being tested.
Parameters
valueThe object to check.
Returns
true if value is exactly of type T, false otherwise.
Note
Requires RTTI to be enabled.

◆ instanceof()

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
TThe target type to check against.
TyThe type of the object being tested.
Parameters
valueThe object to check.
Returns
true if value is an instance of T or derived from T, false otherwise.
Note
Requires RTTI to be enabled.

◆ static_instanceof()

template<l61Obj T, l61Obj Ty>
bool l61::meta::static_instanceof ( const Ty & )
constexpr

Checks if a value is an instance of type T (or derived from T) at compile-time.

Uses the std::derived_from concept to check inheritance relationships between Ty and T at compile-time. This is a constexpr check and does not require RTTI.

Template Parameters
TThe target type to check against.
TyThe type of the object being tested.
Returns
true if Ty is derived from T (or is T itself), false otherwise.
Note
Evaluated at compile-time. Does not inspect the dynamic type.

Variable Documentation

◆ always_false

template<typename>
bool l61::meta::always_false = false
inlineconstexpr

◆ always_true

template<typename>
bool l61::meta::always_true = true
inlineconstexpr

◆ is_eventBus_freq_compatible_v

template<typename T>
bool l61::meta::is_eventBus_freq_compatible_v = is_eventBus_freq_compatible<T>::value
inlineconstexpr

◆ null

nulling::null_t l61::meta::null
inlineconstexpr