Ver Fonte

meta: use find_member to slightly reduce symbol size

skypjack há 3 meses atrás
pai
commit
51c7533265
1 ficheiros alterados com 6 adições e 12 exclusões
  1. 6 12
      src/entt/meta/meta.hpp

+ 6 - 12
src/entt/meta/meta.hpp

@@ -479,10 +479,8 @@ public:
                 }
 
                 if(const auto &from = fetch_node(); from.details != nullptr) {
-                    for(auto &&elem: from.details->conv) {
-                        if(elem.type == entt::type_hash<std::remove_const_t<std::remove_reference_t<Type>>>::value()) {
-                            return elem.conv(*ctx, storage.data());
-                        }
+                    if(const auto *elem = internal::find_member<&internal::meta_conv_node::type>(from.details->conv, entt::type_hash<std::remove_const_t<std::remove_reference_t<Type>>>::value()); elem != nullptr) {
+                        return elem->conv(*ctx, storage.data());
                     }
 
                     for(auto &&curr: from.details->base) {
@@ -1313,10 +1311,8 @@ public:
         } else if(const auto &from = fetch_node(); from.conversion_helper && (other.is_arithmetic() || other.is_enum())) {
             return true;
         } else if(from.details) {
-            for(auto &&elem: from.details->conv) {
-                if(elem.type == to) {
-                    return true;
-                }
+            if(const auto *elem = internal::find_member<&internal::meta_conv_node::type>(from.details->conv, to); elem != nullptr) {
+                return true;
             }
 
             for(auto &&curr: from.details->base) {
@@ -1575,10 +1571,8 @@ bool meta_any::set(const id_type id, Type &&value) {
         }
 
         if(const auto &from = fetch_node(); from.details) {
-            for(auto &&elem: from.details->conv) {
-                if(elem.type == type.info().hash()) {
-                    return elem.conv(*ctx, storage.data());
-                }
+            if(const auto *elem = internal::find_member<&internal::meta_conv_node::type>(from.details->conv, type.info().hash()); elem != nullptr) {
+                return elem->conv(*ctx, storage.data());
             }
 
             for(auto &&curr: from.details->base) {