54 template<
typename T>
requires(!std::is_same_v<std::decay_t<T>,
MetaArgument> && !std::is_same_v<std::decay_t<T>,
Box> && !std::is_same_v<std::decay_t<T>,
Box>)
59 using namespace std::literals;
60 using Decay = std::decay_t<T>;
63 throw BadMetaValueCast(
"Incompatible argument cast from LValue to RValue reference");
74 if(
auto* data = value->data<Decay>())
75 return std::move(*data);
79 return std::move(*
static_cast<Decay*
>(
const_cast<void*
>(ptr)));
84 using Decay = std::decay_t<T>;
86 const auto* value = &
mValue;
94 if(
auto* data = value->data<Decay>())
99 return *
static_cast<const Decay*
>(ptr);
104 using namespace std::literals;
105 using Decay = std::decay_t<T>;
108 throw BadMetaValueCast(
"Incompatible argument cast from RValue to non cost LValue reference");
119 return value->ref<Decay>();
124 using namespace std::literals;
125 using Decay = std::decay_t<T>;
127 const auto* value = &
mValue;
136 return value->to<Decay>();
140 using tag_t = std::conditional_t<std::is_rvalue_reference_v<T>, std::integral_constant<int, 0>,
141 std::conditional_t<is_lvalue_const_reference<T>, std::integral_constant<int, 1>,
142 std::conditional_t<std::is_lvalue_reference_v<T>, std::integral_constant<int, 2>, std::integral_constant<int, 3>>>>;
Definition MetaError.hpp:21
A value type that can hold any alongside it's type information.
Definition Box.hpp:40
void * data() noexcept
Returns pointer to decayed type.
Definition Box.hpp:260
TypeID getTypeID() const noexcept
Gets the ID of the type held by the variant.
Definition Box.hpp:171
bool empty() const noexcept
Checks if the variant is empty (i.e. holds no value).
Box cref() const &
Gets a reference to the meta value.
T to() const &
Gets the value of the variant as a T.
Definition Box.hpp:332
Box ref() const &
Gets a reference to the meta value.
Represents a reflected C++ type. Can be used to get metadata from a C++ type.
Definition Type.hpp:32
TypeID getTypeID() const noexcept
Gets the type ID.
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25