diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 6db65b50e..e5851c9ad 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -164,37 +164,37 @@ using meta_any_policy = any_policy; /*! @brief Opaque wrapper for values of any type. */ class meta_any { - using vtable_type = void(const internal::meta_traits op, const bool, const void *, void *); + using vtable_type = void(const internal::meta_traits op, const bool, const meta_any &, void *); template - static std::enable_if_t>, Type>> basic_vtable([[maybe_unused]] const internal::meta_traits req, [[maybe_unused]] const bool const_only, [[maybe_unused]] const void *value, [[maybe_unused]] void *other) { + static std::enable_if_t>, Type>> basic_vtable([[maybe_unused]] const internal::meta_traits req, [[maybe_unused]] const bool const_only, [[maybe_unused]] const meta_any &self, [[maybe_unused]] void *other) { if constexpr(is_meta_pointer_like_v) { if(req == internal::meta_traits::is_meta_pointer_like) { if constexpr(std::is_function_v::element_type>) { - static_cast(other)->emplace(*static_cast(value)); + static_cast(other)->emplace(*static_cast(self.data())); } else if constexpr(!std::is_void_v::element_type>>) { - using in_place_type = decltype(adl_meta_pointer_like::dereference(*static_cast(value))); + using in_place_type = decltype(adl_meta_pointer_like::dereference(*static_cast(self.data()))); if constexpr(std::is_constructible_v) { - if(const auto &pointer_like = *static_cast(value); pointer_like) { + if(const auto &pointer_like = *static_cast(self.data()); pointer_like) { static_cast(other)->emplace(adl_meta_pointer_like::dereference(pointer_like)); } } else { - static_cast(other)->emplace(adl_meta_pointer_like::dereference(*static_cast(value))); + static_cast(other)->emplace(adl_meta_pointer_like::dereference(*static_cast(self.data()))); } } } } if constexpr(is_complete_v>) { - if(const meta_any *parent = static_cast(value); req == internal::meta_traits::is_meta_sequence_container) { - *static_cast(other) = const_only ? meta_sequence_container{*parent->ctx, *static_cast(parent->data())} : meta_sequence_container{*parent->ctx, *static_cast(const_cast(parent->data()))}; + if(req == internal::meta_traits::is_meta_sequence_container) { + *static_cast(other) = const_only ? meta_sequence_container{*self.ctx, *static_cast(self.data())} : meta_sequence_container{*self.ctx, *static_cast(const_cast(self.data()))}; } } if constexpr(is_complete_v>) { - if(const meta_any *parent = static_cast(value); req == internal::meta_traits::is_meta_associative_container) { - *static_cast(other) = const_only ? meta_associative_container{*parent->ctx, *static_cast(parent->data())} : meta_associative_container{*parent->ctx, *static_cast(const_cast(parent->data()))}; + if(req == internal::meta_traits::is_meta_associative_container) { + *static_cast(other) = const_only ? meta_associative_container{*self.ctx, *static_cast(self.data())} : meta_associative_container{*self.ctx, *static_cast(const_cast(self.data()))}; } } } @@ -524,14 +524,14 @@ public: */ [[nodiscard]] meta_sequence_container as_sequence_container() noexcept { meta_sequence_container proxy{}; - vtable(internal::meta_traits::is_meta_sequence_container, policy() == meta_any_policy::cref, this, &proxy); + vtable(internal::meta_traits::is_meta_sequence_container, policy() == meta_any_policy::cref, *this, &proxy); return proxy; } /*! @copydoc as_sequence_container */ [[nodiscard]] meta_sequence_container as_sequence_container() const noexcept { meta_sequence_container proxy{}; - vtable(internal::meta_traits::is_meta_sequence_container, true, this, &proxy); + vtable(internal::meta_traits::is_meta_sequence_container, true, *this, &proxy); return proxy; } @@ -541,14 +541,14 @@ public: */ [[nodiscard]] meta_associative_container as_associative_container() noexcept { meta_associative_container proxy{}; - vtable(internal::meta_traits::is_meta_associative_container, policy() == meta_any_policy::cref, this, &proxy); + vtable(internal::meta_traits::is_meta_associative_container, policy() == meta_any_policy::cref, *this, &proxy); return proxy; } /*! @copydoc as_associative_container */ [[nodiscard]] meta_associative_container as_associative_container() const noexcept { meta_associative_container proxy{}; - vtable(internal::meta_traits::is_meta_associative_container, true, this, &proxy); + vtable(internal::meta_traits::is_meta_associative_container, true, *this, &proxy); return proxy; } @@ -559,7 +559,7 @@ public: */ [[nodiscard]] meta_any operator*() const noexcept { meta_any ret{meta_ctx_arg, *ctx}; - vtable(internal::meta_traits::is_meta_pointer_like, true, storage.data(), &ret); + vtable(internal::meta_traits::is_meta_pointer_like, true, *this, &ret); return ret; }