diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 1a66929b3..9a3e576f8 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -312,8 +312,13 @@ public: /*! @brief Group handler type. */ using handler = internal::group_handler; - /*! @brief Group opaque marker. */ - static constexpr id_type group_id = type_hash, get_t...>, exclude_t...>>>::value(); + /** + * @brief Group opaque identifier. + * @return Group opaque identifier. + */ + static id_type group_id() noexcept { + return type_hash, get_t...>, exclude_t...>>>::value(); + } /*! @brief Default constructor to use to create empty, invalid groups. */ basic_group() noexcept @@ -722,8 +727,13 @@ public: /*! @brief Group handler type. */ using handler = internal::group_handler; - /*! @brief Group opaque marker. */ - static constexpr id_type group_id = type_hash...>, get_t...>, exclude_t...>>>::value(); + /** + * @brief Group opaque identifier. + * @return Group opaque identifier. + */ + static id_type group_id() noexcept { + return type_hash...>, get_t...>, exclude_t...>>>::value(); + } /*! @brief Default constructor to use to create empty, invalid groups. */ basic_group() noexcept diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 7e6090ca4..8edd5aaaf 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -1070,7 +1070,7 @@ public: using group_type = basic_group...>, get_t...>, exclude_t...>>; using handler_type = typename group_type::handler; - if(auto it = groups.find(group_type::group_id); it != groups.cend()) { + if(auto it = groups.find(group_type::group_id()); it != groups.cend()) { return {*std::static_pointer_cast(it->second)}; } @@ -1084,7 +1084,7 @@ public: ENTT_ASSERT(std::all_of(groups.cbegin(), groups.cend(), [&elem](const auto &data) { return data.second->owned(elem, sizeof...(Owned)) == 0u; }), "Conflicting groups"); } - groups.emplace(group_type::group_id, handler); + groups.emplace(group_type::group_id(), handler); return {*handler}; } @@ -1095,7 +1095,7 @@ public: using group_type = basic_group...>, get_t...>, exclude_t...>>; using handler_type = typename group_type::handler; - if(auto it = groups.find(group_type::group_id); it != groups.cend()) { + if(auto it = groups.find(group_type::group_id()); it != groups.cend()) { return {*std::static_pointer_cast(it->second)}; }