Explorar o código

registry: extra check when moving a registry

Michele Caini %!s(int64=3) %!d(string=hai) anos
pai
achega
f3e7f98b48
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/entt/entity/registry.hpp

+ 4 - 0
src/entt/entity/registry.hpp

@@ -398,6 +398,8 @@ public:
           epool{std::move(other.epool)},
           pools{std::move(other.pools)},
           groups{std::move(other.groups)} {
+        ENTT_ASSERT(alloc_traits::is_always_equal::value || epool.get_allocator() == other.epool.get_allocator(), "Copying a registry is not allowed");
+
         rebind();
     }
 
@@ -407,6 +409,8 @@ public:
      * @return This registry.
      */
     basic_registry &operator=(basic_registry &&other) noexcept {
+        ENTT_ASSERT(alloc_traits::is_always_equal::value || epool.get_allocator() == other.epool.get_allocator(), "Copying a registry is not allowed");
+
         vars = std::move(other.vars);
         free_list = std::move(other.free_list);
         epool = std::move(other.epool);