11#ifndef AMINO_CORE_TYPE_ID_H
12#define AMINO_CORE_TYPE_ID_H
17#include "internal/TypeInfo.h"
90 friend ::
Amino::Internal::TypeInfoDetails;
96 static
TypeId get() noexcept;
103 explicit constexpr
TypeId(
std::nullptr_t) : m_info(
nullptr) {}
107 explicit constexpr TypeId(Internal::TypeInfo
const* info) : m_info(info) {
112 Internal::TypeInfo
const& info()
const {
120 Internal::TypeInfo
const* m_info =
nullptr;
128 sizeof(TypeId) ==
sizeof(
void*),
"TypeId must be the size of a pointer.");
130 alignof(TypeId) ==
alignof(
void*),
"TypeId must be aligned like pointer.");
136TypeId TypeId::get() noexcept {
137#if AMINO_INTERNAL_OPTION_HAS_RTTI
138 return TypeId(&Internal::TypeInfo::get<T>());
145 constexpr bool isRttiEnabled = (
alignof(T) == -42);
146 static_assert(isRttiEnabled,
"Can't use getTypeId() without rtti enabled!");
147 AMINO_INTERNAL_UNREACHABLE(
"Can't be instantiated");
156inline TypeId TypeId::get<void>() noexcept {
157 return TypeId(&Internal::TypeInfo::get<void>());
169 return TypeId::get<T>();
175inline constexpr TypeId getTypeId<Internal::NullTypeInfo>() noexcept {
176 return TypeId(
nullptr);
TypeId getTypeId() noexcept
Returns the TypeId for the given Type.
bool operator<(Ptr< T > const &x, Ptr< U > const &y) noexcept
Compares the pointer values.
bool operator>(Ptr< T > const &x, Ptr< U > const &y) noexcept
Compares the pointer values.
Type identifier for a type.
bool operator>=(TypeId o) const noexcept
TypeId's ordering comparison operators, to allow storing TypeId in ordered containers (ONLY!...
bool operator==(TypeId o) const noexcept
TypeId's equality comparison operators.
bool operator<=(TypeId o) const noexcept
TypeId's ordering comparison operators, to allow storing TypeId in ordered containers (ONLY!...
bool operator!=(TypeId o) const noexcept
TypeId's equality comparison operators.
TypeId()=delete
Can't default construct a TypeId.
size_t computeHash() const
Computes a hash for this TypeId.