Kaynağa Gözat

meta: favor top-level conversion functions over bases lookup

Michele Caini 3 yıl önce
ebeveyn
işleme
496fefdd01
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  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(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) {
             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;
             }
         }
-
-        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())) {