فهرست منبع

meta: cleanup

skypjack 6 روز پیش
والد
کامیت
f60f62faf4
2فایلهای تغییر یافته به همراه4 افزوده شده و 9 حذف شده
  1. 2 7
      src/entt/meta/node.hpp
  2. 2 2
      src/entt/meta/resolve.hpp

+ 2 - 7
src/entt/meta/node.hpp

@@ -269,16 +269,11 @@ auto setup_node_for() noexcept {
     return node;
 }
 
-[[nodiscard]] inline const meta_type_node *try_resolve(const meta_context &context, const type_info &info) noexcept {
-    const auto it = context.bucket.find(info.hash());
-    return (it != context.bucket.end()) ? it->second.get() : nullptr;
-}
-
 template<cvref_unqualified Type>
 [[nodiscard]] const meta_type_node &resolve(const meta_context &context) noexcept {
     static const meta_type_node node = setup_node_for<Type>();
-    const auto *elem = try_resolve(context, *node.info);
-    return (elem == nullptr) ? node : *elem;
+    const auto it = context.bucket.find(node.info->hash());
+    return (it == context.bucket.cend()) ? node : *it->second;
 }
 
 } // namespace internal

+ 2 - 2
src/entt/meta/resolve.hpp

@@ -91,8 +91,8 @@ template<typename Type>
  */
 [[nodiscard]] inline meta_type resolve(const meta_ctx &ctx, const type_info &info) noexcept {
     const auto &context = internal::meta_context::from(ctx);
-    const auto *elem = internal::try_resolve(context, info);
-    return (elem != nullptr) ? meta_type{ctx, *elem} : meta_type{};
+    const auto it = context.bucket.find(info.hash());
+    return (it == context.bucket.cend()) ? meta_type{} : meta_type{ctx, *it->second};
 }
 
 /**