family: it no longer dacays types
This commit is contained in:
@@ -20,10 +20,6 @@ template<typename...>
|
||||
class family {
|
||||
inline static ENTT_MAYBE_ATOMIC(ENTT_ID_TYPE) identifier{};
|
||||
|
||||
template<typename...>
|
||||
// clang (since version 9) started to complain if auto is used instead of ENTT_ID_TYPE
|
||||
inline static const ENTT_ID_TYPE inner = identifier++;
|
||||
|
||||
public:
|
||||
/*! @brief Unsigned integer type. */
|
||||
using family_type = ENTT_ID_TYPE;
|
||||
@@ -31,7 +27,7 @@ public:
|
||||
/*! @brief Statically generated unique identifier for the given type. */
|
||||
template<typename... Type>
|
||||
// at the time I'm writing, clang crashes during compilation if auto is used instead of family_type
|
||||
inline static const family_type type = inner<std::decay_t<Type>...>;
|
||||
inline static const family_type type = identifier++;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ class basic_registry {
|
||||
if constexpr(is_named_type_v<Type>) {
|
||||
return named_type_traits_v<Type>;
|
||||
} else {
|
||||
return Family::template type<Type>;
|
||||
return Family::template type<std::decay_t<Type>>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class dispatcher {
|
||||
if constexpr(is_named_type_v<Event>) {
|
||||
return named_type_traits_v<Event>;
|
||||
} else {
|
||||
return event_family::type<Event>;
|
||||
return event_family::type<std::decay_t<Event>>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class emitter {
|
||||
if constexpr(is_named_type_v<Event>) {
|
||||
return named_type_traits_v<Event>;
|
||||
} else {
|
||||
return handler_family::type<Event>;
|
||||
return handler_family::type<std::decay_t<Event>>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ TEST(Family, Functionalities) {
|
||||
}
|
||||
|
||||
TEST(Family, Uniqueness) {
|
||||
ASSERT_EQ(a_family::type<int>, a_family::type<int &>);
|
||||
ASSERT_EQ(a_family::type<int>, a_family::type<int &&>);
|
||||
ASSERT_EQ(a_family::type<int>, a_family::type<const int &>);
|
||||
ASSERT_NE(a_family::type<int>, a_family::type<int &>);
|
||||
ASSERT_NE(a_family::type<int>, a_family::type<int &&>);
|
||||
ASSERT_NE(a_family::type<int>, a_family::type<const int &>);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user