From 0fa586a3d8723bb14d802edfb0ffffb46f2663f4 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sat, 6 Nov 2021 23:31:57 +0100 Subject: [PATCH] type_id: reduce the number of static variables due to type_id --- src/entt/core/type_info.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/entt/core/type_info.hpp b/src/entt/core/type_info.hpp index 029a973f9..827bbb1eb 100644 --- a/src/entt/core/type_info.hpp +++ b/src/entt/core/type_info.hpp @@ -254,8 +254,12 @@ private: */ template [[nodiscard]] const type_info &type_id() ENTT_NOEXCEPT { - static type_info instance{std::in_place_type>>}; - return instance; + if constexpr(std::is_same_v>>) { + static type_info instance{std::in_place_type>>}; + return instance; + } else { + return type_id>>(); + } } } // namespace entt