Browse Source

observer: drop mask parameter

Michele Caini 1 year ago
parent
commit
53b85ecb39
2 changed files with 5 additions and 5 deletions
  1. 1 1
      src/entt/entity/fwd.hpp
  2. 4 4
      src/entt/entity/observer.hpp

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

@@ -44,7 +44,7 @@ class basic_runtime_view;
 template<typename, typename, typename>
 class basic_group;
 
-template<typename, typename Mask = std::uint32_t, typename = std::allocator<Mask>>
+template<typename, typename = std::allocator<void>>
 class basic_observer;
 
 template<typename>

+ 4 - 4
src/entt/entity/observer.hpp

@@ -154,12 +154,12 @@ inline constexpr basic_collector<> collector{};
  * pointers.
  *
  * @tparam Registry Basic registry type.
- * @tparam Mask Mask type.
  * @tparam Allocator Type of allocator used to manage memory and elements.
  */
-template<typename Registry, typename Mask, typename Allocator>
+template<typename Registry, typename Allocator>
 class basic_observer {
-    using storage_type = basic_storage<Mask, typename Registry::entity_type, Allocator>;
+    using mask_type = std::uint64_t;
+    using storage_type = basic_storage<mask_type, typename Registry::entity_type, typename std::allocator_traits<Allocator>::template rebind_alloc<mask_type>>;
 
     template<std::size_t Index>
     static void discard_if(storage_type &storage, Registry &, const typename Registry::entity_type entt) {
@@ -248,7 +248,7 @@ class basic_observer {
 
     template<typename... Matcher, std::size_t... Index>
     void connect(std::index_sequence<Index...>) {
-        static_assert(sizeof...(Matcher) < std::numeric_limits<Mask>::digits, "Too many matchers");
+        static_assert(sizeof...(Matcher) < std::numeric_limits<mask_type>::digits, "Too many matchers");
         (matcher_handler<Matcher>::template connect<Index>(storage, *parent), ...);
     }