Browse Source

group: common base class for group handlers

Michele Caini 3 years ago
parent
commit
aaeb686ec7
2 changed files with 5 additions and 3 deletions
  1. 4 2
      src/entt/entity/group.hpp
  2. 1 1
      src/entt/entity/registry.hpp

+ 4 - 2
src/entt/entity/group.hpp

@@ -90,11 +90,13 @@ template<typename... Lhs, typename... Rhs>
     return !(lhs == rhs);
     return !(lhs == rhs);
 }
 }
 
 
+struct basic_group_handler {};
+
 template<typename, typename, typename>
 template<typename, typename, typename>
 class group_handler;
 class group_handler;
 
 
 template<typename... Owned, typename... Get, typename... Exclude>
 template<typename... Owned, typename... Get, typename... Exclude>
-class group_handler<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> {
+class group_handler<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> final: public basic_group_handler {
     // nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
     // nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
     static_assert(!std::disjunction_v<std::bool_constant<Owned::traits_type::in_place_delete>...>, "Groups do not support in-place delete");
     static_assert(!std::disjunction_v<std::bool_constant<Owned::traits_type::in_place_delete>...>, "Groups do not support in-place delete");
     static_assert(!std::disjunction_v<std::is_const<Owned>..., std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");
     static_assert(!std::disjunction_v<std::is_const<Owned>..., std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");
@@ -139,7 +141,7 @@ private:
 };
 };
 
 
 template<typename... Get, typename... Exclude>
 template<typename... Get, typename... Exclude>
-class group_handler<owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
+class group_handler<owned_t<>, get_t<Get...>, exclude_t<Exclude...>>: public basic_group_handler {
     // nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
     // nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
     static_assert(!std::disjunction_v<std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");
     static_assert(!std::disjunction_v<std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");
 
 

+ 1 - 1
src/entt/entity/registry.hpp

@@ -248,7 +248,7 @@ class basic_registry {
 
 
     struct group_data {
     struct group_data {
         std::size_t size;
         std::size_t size;
-        std::shared_ptr<void> handler;
+        std::shared_ptr<internal::basic_group_handler> handler;
         bool (*owned)(const id_type) noexcept;
         bool (*owned)(const id_type) noexcept;
         bool (*get)(const id_type) noexcept;
         bool (*get)(const id_type) noexcept;
         bool (*exclude)(const id_type) noexcept;
         bool (*exclude)(const id_type) noexcept;