Class type_info
Synopsis
#include <src/entt/core/type_info.hpp>
class 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 / Meet the runtime
- Push EnTT Across Boundaries / The EnTT way
Methods
type_info overload | Default constructor. | |
type_info overload | Default copy constructor. | |
type_info overload | Default move constructor. | |
hash | Type hash. | |
name | Type name. | |
operator bool | Checks if a type info object is properly initialized. | |
operator= overload | Default copy assignment operator. | |
operator= overload | Default move assignment operator. | |
operator== | Compares the contents of two type info objects. | |
seq | Type sequential identifier. |
Source
Lines 141-219 in src/entt/core/type_info.hpp.
class type_info final {
template<typename>
friend type_info type_id() ENTT_NOEXCEPT;
type_info(id_type seq_v, id_type hash_v, std::string_view name_v) ENTT_NOEXCEPT
: seq_value{seq_v},
hash_value{hash_v},
name_value{name_v}
{}
public:
/*! @brief Default constructor. */
type_info() ENTT_NOEXCEPT
: type_info({}, {}, {})
{}
/*! @brief Default copy constructor. */
type_info(const type_info &) ENTT_NOEXCEPT = default;
/*! @brief Default move constructor. */
type_info(type_info &&) ENTT_NOEXCEPT = default;
/**
* @brief Default copy assignment operator.
* @return This type info object.
*/
type_info & operator=(const type_info &) ENTT_NOEXCEPT = default;
/**
* @brief Default move assignment operator.
* @return This type info object.
*/
type_info & operator=(type_info &&) ENTT_NOEXCEPT = default;
/**
* @brief Checks if a type info object is properly initialized.
* @return True if the object is properly initialized, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
return !name_value.empty();
}
/**
* @brief Type sequential identifier.
* @return Type sequential identifier.
*/
[[nodiscard]] id_type seq() const ENTT_NOEXCEPT {
return seq_value;
}
/**
* @brief Type hash.
* @return Type hash.
*/
[[nodiscard]] id_type hash() const ENTT_NOEXCEPT {
return hash_value;
}
/**
* @brief Type name.
* @return Type name.
*/
[[nodiscard]] std::string_view name() const ENTT_NOEXCEPT {
return name_value;
}
/**
* @brief Compares the contents of two type info objects.
* @param other Object with which to compare.
* @return False if the two contents differ, true otherwise.
*/
[[nodiscard]] bool operator==(const type_info &other) const ENTT_NOEXCEPT {
return hash_value == other.hash_value;
}
private:
id_type seq_value;
id_type hash_value;
std::string_view name_value;
};