Browse Source

meta: cleanup

skypjack 6 months ago
parent
commit
9170fc850b
1 changed files with 1 additions and 7 deletions
  1. 1 7
      src/entt/meta/meta.hpp

+ 1 - 7
src/entt/meta/meta.hpp

@@ -495,7 +495,6 @@ public:
         if constexpr(std::is_reference_v<Type> && !std::is_const_v<std::remove_reference_t<Type>>) {
         if constexpr(std::is_reference_v<Type> && !std::is_const_v<std::remove_reference_t<Type>>) {
             return meta_any{meta_ctx_arg, *ctx};
             return meta_any{meta_ctx_arg, *ctx};
         } else {
         } else {
-            // also support early return for performance reasons
             return (storage.info() == entt::type_id<Type>()) ? as_ref() : allow_cast(meta_type{*ctx, internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(internal::meta_context::from(*ctx))});
             return (storage.info() == entt::type_id<Type>()) ? as_ref() : allow_cast(meta_type{*ctx, internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(internal::meta_context::from(*ctx))});
         }
         }
     }
     }
@@ -510,7 +509,6 @@ public:
         if constexpr(std::is_reference_v<Type> && !std::is_const_v<std::remove_reference_t<Type>>) {
         if constexpr(std::is_reference_v<Type> && !std::is_const_v<std::remove_reference_t<Type>>) {
             return allow_cast<const std::remove_reference_t<Type> &>() && (storage.data() != nullptr);
             return allow_cast<const std::remove_reference_t<Type> &>() && (storage.data() != nullptr);
         } else {
         } else {
-            // also support early return for performance reasons
             return (storage.info() == entt::type_id<Type>()) || allow_cast(meta_type{*ctx, internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(internal::meta_context::from(*ctx))});
             return (storage.info() == entt::type_id<Type>()) || allow_cast(meta_type{*ctx, internal::resolve<std::remove_cv_t<std::remove_reference_t<Type>>>(internal::meta_context::from(*ctx))});
         }
         }
     }
     }
@@ -1605,11 +1603,7 @@ inline bool meta_any::assign(const meta_any &other) {
 }
 }
 
 
 inline bool meta_any::assign(meta_any &&other) {
 inline bool meta_any::assign(meta_any &&other) {
-    if(storage.info() == other.storage.info()) {
-        return storage.assign(std::move(other.storage));
-    }
-
-    return assign(std::as_const(other));
+    return (storage.info() == other.storage.info()) ? storage.assign(std::move(other.storage)) : assign(std::as_const(other));
 }
 }
 
 
 [[nodiscard]] inline meta_type meta_data::type() const noexcept {
 [[nodiscard]] inline meta_type meta_data::type() const noexcept {