Procházet zdrojové kódy

registry: strict check on value_type for allocators

Michele Caini před 3 roky
rodič
revize
1e36b6c4b6
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 3 2
      src/entt/entity/registry.hpp

+ 3 - 2
src/entt/entity/registry.hpp

@@ -249,9 +249,10 @@ private:
  */
 template<typename Entity, typename Allocator>
 class basic_registry {
-    using entity_traits = entt_traits<Entity>;
-    using basic_common_type = basic_sparse_set<Entity, Allocator>;
     using alloc_traits = typename std::allocator_traits<Allocator>;
+    static_assert(std::is_same_v<typename alloc_traits::value_type, Entity>, "Invalid value type");
+    using basic_common_type = basic_sparse_set<Entity, Allocator>;
+    using entity_traits = entt_traits<Entity>;
 
     template<typename Type>
     using storage_for_type = typename storage_for<Type, Entity>::type;