meta: favor top-level conversion functions over bases lookup

This commit is contained in:
Michele Caini
2022-10-18 10:54:31 +02:00
parent 26f85050c1
commit 496fefdd01

View File

@@ -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())) {