type_id: reduce the number of static variables due to type_id
This commit is contained in:
@@ -254,8 +254,12 @@ private:
|
||||
*/
|
||||
template<typename Type>
|
||||
[[nodiscard]] const type_info &type_id() ENTT_NOEXCEPT {
|
||||
static type_info instance{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>};
|
||||
return instance;
|
||||
if constexpr(std::is_same_v<Type, std::remove_cv_t<std::remove_reference_t<Type>>>) {
|
||||
static type_info instance{std::in_place_type<std::remove_cv_t<std::remove_reference_t<Type>>>};
|
||||
return instance;
|
||||
} else {
|
||||
return type_id<std::remove_cv_t<std::remove_reference_t<Type>>>();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace entt
|
||||
|
||||
Reference in New Issue
Block a user