Struct type_info
Synopsis
#include <src/entt/core/type_info.hpp>
struct type_info final
Description
Implementation specific information about a type.
Mentioned in
- Core Functionalities / Any as in any type
- Core Functionalities / Type info
- Entity Component System / A base class to rule them all
- Push EnTT Across Boundaries / Smooth until proven otherwise
Methods
type_info | Constructs a type info object for a given type. | |
hash | Type hash. | |
index | Type index. | |
name | Type name. |
Source
Lines 141-180 in src/entt/core/type_info.hpp.
struct type_info final {
/**
* @brief Constructs a type info object for a given type.
* @tparam Type Type for which to construct a type info object.
*/
template<typename Type>
constexpr type_info(std::in_place_type_t<Type>) ENTT_NOEXCEPT
: seq{type_index<std::remove_cv_t<std::remove_reference_t<Type>>>::value()},
identifier{type_hash<std::remove_cv_t<std::remove_reference_t<Type>>>::value()},
alias{type_name<std::remove_cv_t<std::remove_reference_t<Type>>>::value()} {}
/**
* @brief Type index.
* @return Type index.
*/
[[nodiscard]] constexpr id_type index() const ENTT_NOEXCEPT {
return seq;
}
/**
* @brief Type hash.
* @return Type hash.
*/
[[nodiscard]] constexpr id_type hash() const ENTT_NOEXCEPT {
return identifier;
}
/**
* @brief Type name.
* @return Type name.
*/
[[nodiscard]] constexpr std::string_view name() const ENTT_NOEXCEPT {
return alias;
}
private:
id_type seq;
id_type identifier;
std::string_view alias;
};