type_info:🆔 family-like fallback
This commit is contained in:
@@ -25,5 +25,6 @@
|
||||
- ::group improve, reduce code
|
||||
|
||||
* Mission: get rid of named types
|
||||
- make family-like fallback for type_info::id work across boundaries
|
||||
- update doc: dispatcher, emitter, registry, meta, across boundaries
|
||||
- review and suppress warnings, if any
|
||||
|
||||
@@ -15,22 +15,53 @@ namespace entt {
|
||||
*/
|
||||
template<typename Type, typename = void>
|
||||
struct type_info {
|
||||
#if defined _MSC_VER
|
||||
/**
|
||||
* @brief Returns the numeric representation of a given type.
|
||||
* @return The numeric representation of the given type.
|
||||
*/
|
||||
#if defined _MSC_VER
|
||||
static constexpr ENTT_ID_TYPE id() ENTT_NOEXCEPT {
|
||||
return entt::hashed_string{__FUNCSIG__};
|
||||
}
|
||||
#elif defined __GNUC__
|
||||
/**
|
||||
* @brief Returns the numeric representation of a given type.
|
||||
* @return The numeric representation of the given type.
|
||||
*/
|
||||
static constexpr ENTT_ID_TYPE id() ENTT_NOEXCEPT {
|
||||
return entt::hashed_string{__PRETTY_FUNCTION__};
|
||||
}
|
||||
#else
|
||||
static ENTT_ID_TYPE id() ENTT_NOEXCEPT;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @cond TURN_OFF_DOXYGEN
|
||||
* Internal details not to be documented.
|
||||
*/
|
||||
|
||||
|
||||
namespace internal {
|
||||
|
||||
|
||||
struct type_id_generator {
|
||||
static ENTT_ID_TYPE next() ENTT_NOEXCEPT {
|
||||
static ENTT_ID_TYPE value{};
|
||||
return value++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal details not to be documented.
|
||||
* @endcond TURN_OFF_DOXYGEN
|
||||
*/
|
||||
|
||||
|
||||
template<typename Type, typename Cond>
|
||||
ENTT_ID_TYPE type_info<Type, Cond>::id() ENTT_NOEXCEPT {
|
||||
static const ENTT_ID_TYPE value = internal::type_id_generator::next();
|
||||
return value;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user