Struct type_info

Synopsis

#include <src/entt/core/type_info.hpp>

struct type_info final

Description

Implementation specific information about a type.

Mentioned in

Methods

type_infoConstructs a type info object for a given type.
hashType hash.
indexType index.
nameType 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;
};





Add Discussion

Log in to comment