Procházet zdrojové kódy

meta: favor top-level conversion functions over bases lookup

Michele Caini před 3 roky
rodič
revize
496fefdd01
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      src/entt/meta/meta.hpp

+ 4 - 4
src/entt/meta/meta.hpp

@@ -1528,6 +1528,10 @@ bool meta_any::set(const id_type id, Type &&value) {
     }
     }
 
 
     if(const auto *value = data(); node.details) {
     if(const auto *value = data(); node.details) {
+        if(auto it = node.details->conv.find(type.info().hash()); it != node.details->conv.cend()) {
+            return it->second.conv(*ctx, data());
+        }
+
         for(auto &&curr: node.details->base) {
         for(auto &&curr: node.details->base) {
             const auto &as_const = curr.second.type(internal::meta_context::from(*ctx)).from_void(*ctx, nullptr, curr.second.cast(value));
             const auto &as_const = curr.second.type(internal::meta_context::from(*ctx)).from_void(*ctx, nullptr, curr.second.cast(value));
 
 
@@ -1535,10 +1539,6 @@ bool meta_any::set(const id_type id, Type &&value) {
                 return other;
                 return other;
             }
             }
         }
         }
-
-        if(auto it = node.details->conv.find(type.info().hash()); it != node.details->conv.cend()) {
-            return it->second.conv(*ctx, data());
-        }
     }
     }
 
 
     if(node.conversion_helper && (type.is_arithmetic() || type.is_enum())) {
     if(node.conversion_helper && (type.is_arithmetic() || type.is_enum())) {