Explorar o código

meta: early exit when assigning

skypjack hai 6 meses
pai
achega
973f010d85
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/entt/meta/meta.hpp

+ 5 - 1
src/entt/meta/meta.hpp

@@ -1596,7 +1596,11 @@ bool meta_any::set(const id_type id, Type &&value) {
 }
 
 inline bool meta_any::assign(const meta_any &other) {
-    auto value = other.allow_cast({*ctx, node});
+    if(storage.info() == other.storage.info()) {
+        return storage.assign(other.storage);
+    }
+
+    auto value = other.allow_cast(type());
     return value && storage.assign(value.storage);
 }