Struct type_info

Synopsis

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

template<typename Type, typename = void>
struct type_info

Description

Type info.

Template Parameters:

Type - Type for which to generate information.

Mentioned in

Methods

idReturns the numeric representation of a given type.
nameReturns the name of a given type.

Source

Lines 97-138 in src/entt/core/type_info.hpp.

template<typename Type, typename = void>
struct type_info {
    /**
     * @brief Returns the numeric representation of a given type.
     * @return The numeric representation of the given type.
     */
#if defined ENTT_PRETTY_FUNCTION_CONSTEXPR
    [[nodiscard]] static constexpr id_type id() ENTT_NOEXCEPT {
        constexpr auto value = hashed_string::value(ENTT_PRETTY_FUNCTION);
        return value;
    }
#elif defined ENTT_PRETTY_FUNCTION
    [[nodiscard]] static id_type id() ENTT_NOEXCEPT {
        static const auto value = hashed_string::value(ENTT_PRETTY_FUNCTION);
        return value;
    }
#else
    [[nodiscard]] static id_type id() ENTT_NOEXCEPT {
        return type_index<Type>::value();
    }
#endif

    /**
     * @brief Returns the name of a given type.
     * @return The name of the given type.
     */
#if defined ENTT_PRETTY_FUNCTION_CONSTEXPR
    [[nodiscard]] static constexpr std::string_view name() ENTT_NOEXCEPT {
        constexpr auto value = internal::type_name<Type>();
        return value;
    }
#elif defined ENTT_PRETTY_FUNCTION
    [[nodiscard]] static std::string_view name() ENTT_NOEXCEPT {
        static const auto value = internal::type_name<Type>();
        return value;
    }
#else
    [[nodiscard]] static constexpr std::string_view name() ENTT_NOEXCEPT {
        return internal::type_name<Type>();
    }
#endif
};





Add Discussion

Log in to comment