Răsfoiți Sursa

meta: drop deprecated utilities

Michele Caini 11 luni în urmă
părinte
comite
556ff733d5
2 a modificat fișierele cu 17 adăugiri și 62 ștergeri
  1. 0 45
      src/entt/meta/utility.hpp
  2. 17 17
      test/entt/meta/meta_utility.cpp

+ 0 - 45
src/entt/meta/utility.hpp

@@ -342,20 +342,6 @@ template<typename Type, auto Data, typename Policy = as_is_t>
     }
 }
 
-/**
- * @brief Gets the value of a given variable.
- * @tparam Type Reflected type to which the variable is associated.
- * @tparam Data The actual variable to get.
- * @tparam Policy Optional policy (no policy set by default).
- * @param ctx The context from which to search for meta types.
- * @param instance An opaque instance of the underlying type, if required.
- * @return A meta any containing the value of the underlying variable.
- */
-template<typename Type, auto Data, typename Policy = as_is_t>
-[[deprecated("a context is no longer required, it is inferred from the meta_handle")]] [[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_getter(const meta_ctx &ctx, meta_handle instance) {
-    return meta_getter<Type, Data, Policy>(meta_handle{ctx, std::move(instance)});
-}
-
 /**
  * @brief Tries to _invoke_ an object given a list of erased parameters.
  * @tparam Type Reflected type to which the object to _invoke_ is associated.
@@ -371,22 +357,6 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
     return internal::meta_invoke<Type, Policy>(std::move(instance), std::forward<Candidate>(candidate), args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<Candidate>>::args_type::size>{});
 }
 
-/**
- * @brief Tries to _invoke_ an object given a list of erased parameters.
- * @tparam Type Reflected type to which the object to _invoke_ is associated.
- * @tparam Policy Optional policy (no policy set by default).
- * @param ctx The context from which to search for meta types.
- * @tparam Candidate The type of the actual object to _invoke_.
- * @param instance An opaque instance of the underlying type, if required.
- * @param candidate The actual object to _invoke_.
- * @param args Parameters to use to _invoke_ the object.
- * @return A meta any containing the returned value, if any.
- */
-template<typename Type, typename Policy = as_is_t, typename Candidate>
-[[deprecated("a context is no longer required, it is inferred from the meta_handle")]] [[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(const meta_ctx &ctx, meta_handle instance, Candidate &&candidate, meta_any *const args) {
-    return meta_invoke<Type, Policy>(meta_handle{ctx, std::move(instance)}, std::forward<Candidate>(candidate), args);
-}
-
 /**
  * @brief Tries to invoke a function given a list of erased parameters.
  * @tparam Type Reflected type to which the function is associated.
@@ -401,21 +371,6 @@ template<typename Type, auto Candidate, typename Policy = as_is_t>
     return internal::meta_invoke<Type, Policy>(std::move(instance), Candidate, args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<decltype(Candidate)>>::args_type::size>{});
 }
 
-/**
- * @brief Tries to invoke a function given a list of erased parameters.
- * @tparam Type Reflected type to which the function is associated.
- * @tparam Candidate The actual function to invoke.
- * @tparam Policy Optional policy (no policy set by default).
- * @param ctx The context from which to search for meta types.
- * @param instance An opaque instance of the underlying type, if required.
- * @param args Parameters to use to invoke the function.
- * @return A meta any containing the returned value, if any.
- */
-template<typename Type, auto Candidate, typename Policy = as_is_t>
-[[deprecated("a context is no longer required, it is inferred from the meta_handle")]] [[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(const meta_ctx &ctx, meta_handle instance, meta_any *const args) {
-    return meta_invoke<Type, Candidate, Policy>(meta_handle{ctx, std::move(instance)}, args);
-}
-
 /**
  * @brief Tries to construct an instance given a list of erased parameters.
  *

+ 17 - 17
test/entt/meta/meta_utility.cpp

@@ -162,30 +162,30 @@ TEST_F(MetaUtility, MetaGetter) {
     clazz instance{};
 
     ASSERT_FALSE((entt::meta_getter<clazz, &clazz::static_getter>(invalid)));
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::static_getter>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::static_getter>(instance)).cast<int>(), 0);
 
     ASSERT_FALSE((entt::meta_getter<clazz, &clazz::getter>(invalid)));
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::getter>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::getter>(instance)).cast<int>(), 0);
 
     ASSERT_FALSE((entt::meta_getter<clazz, &clazz::member>(invalid)));
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::member>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::member>(instance)).cast<int>(), 0);
     ASSERT_EQ((entt::meta_getter<clazz, &clazz::member>(std::as_const(instance))).cast<int>(), 0);
 
     ASSERT_FALSE((entt::meta_getter<clazz, &clazz::cmember>(invalid)));
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::cmember>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::cmember>(instance)).cast<int>(), 0);
     ASSERT_EQ((entt::meta_getter<clazz, &clazz::cmember>(std::as_const(instance))).cast<int>(), 0);
 
     ASSERT_FALSE((entt::meta_getter<clazz, &clazz::arr>(invalid)));
-    ASSERT_FALSE((entt::meta_getter<clazz, &clazz::arr>(entt::meta_any{}.context(), instance)));
+    ASSERT_FALSE((entt::meta_getter<clazz, &clazz::arr>(instance)));
 
     ASSERT_EQ((entt::meta_getter<clazz, &clazz::value>(invalid)).cast<int>(), 0);
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::value>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::value>(instance)).cast<int>(), 0);
 
     ASSERT_EQ((entt::meta_getter<clazz, &clazz::cvalue>(invalid)).cast<int>(), 0);
-    ASSERT_EQ((entt::meta_getter<clazz, &clazz::cvalue>(entt::meta_any{}.context(), instance)).cast<int>(), 0);
+    ASSERT_EQ((entt::meta_getter<clazz, &clazz::cvalue>(instance)).cast<int>(), 0);
 
     ASSERT_EQ((entt::meta_getter<clazz, 1>(invalid)).cast<int>(), 1);
-    ASSERT_EQ((entt::meta_getter<clazz, 1>(entt::meta_any{}.context(), instance)).cast<int>(), 1);
+    ASSERT_EQ((entt::meta_getter<clazz, 1>(instance)).cast<int>(), 1);
 }
 
 TEST_F(MetaUtility, MetaInvokeWithCandidate) {
@@ -194,22 +194,22 @@ TEST_F(MetaUtility, MetaInvokeWithCandidate) {
     clazz::value = 3;
 
     ASSERT_FALSE((entt::meta_invoke<clazz>({}, &clazz::setter, std::next(args.data()))));
-    ASSERT_FALSE((entt::meta_invoke<clazz>(entt::meta_any{}.context(), {}, &clazz::getter, nullptr)));
+    ASSERT_FALSE((entt::meta_invoke<clazz>({}, &clazz::getter, nullptr)));
 
     ASSERT_TRUE((entt::meta_invoke<clazz>(args[0u], &clazz::setter, std::next(args.data()))));
-    ASSERT_FALSE((entt::meta_invoke<clazz>(entt::meta_any{}.context(), args[0u], &clazz::setter, args.data())));
+    ASSERT_FALSE((entt::meta_invoke<clazz>(args[0u], &clazz::setter, args.data())));
     ASSERT_EQ((entt::meta_invoke<clazz>(args[0u], &clazz::getter, nullptr)).cast<int>(), 4);
-    ASSERT_FALSE((entt::meta_invoke<clazz>(entt::meta_any{}.context(), args[1u], &clazz::getter, nullptr)));
+    ASSERT_FALSE((entt::meta_invoke<clazz>(args[1u], &clazz::getter, nullptr)));
 
     ASSERT_EQ((entt::meta_invoke<clazz>({}, &clazz::get_value, nullptr)).cast<int>(), 3);
-    ASSERT_TRUE((entt::meta_invoke<clazz>(entt::meta_any{}.context(), {}, &clazz::reset_value, nullptr)));
+    ASSERT_TRUE((entt::meta_invoke<clazz>({}, &clazz::reset_value, nullptr)));
     ASSERT_EQ(args[0u].cast<clazz &>().value, 0);
 
     const auto setter = [](int &value) { value = 3; };
     const auto getter = [](int value) { return value * 2; };
 
     ASSERT_TRUE(entt::meta_invoke<test::empty>({}, setter, std::next(args.data())));
-    ASSERT_EQ(entt::meta_invoke<test::empty>(entt::meta_any{}.context(), {}, getter, std::next(args.data())).cast<int>(), 6);
+    ASSERT_EQ(entt::meta_invoke<test::empty>({}, getter, std::next(args.data())).cast<int>(), 6);
 }
 
 TEST_F(MetaUtility, MetaInvoke) {
@@ -218,15 +218,15 @@ TEST_F(MetaUtility, MetaInvoke) {
     clazz::value = 3;
 
     ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::setter>({}, std::next(args.data()))));
-    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::getter>(entt::meta_any{}.context(), {}, nullptr)));
+    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::getter>({}, nullptr)));
 
     ASSERT_TRUE((entt::meta_invoke<clazz, &clazz::setter>(args[0u], std::next(args.data()))));
-    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::setter>(entt::meta_any{}.context(), args[0u], args.data())));
+    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::setter>(args[0u], args.data())));
     ASSERT_EQ((entt::meta_invoke<clazz, &clazz::getter>(args[0u], nullptr)).cast<int>(), 4);
-    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::getter>(entt::meta_any{}.context(), args[1u], nullptr)));
+    ASSERT_FALSE((entt::meta_invoke<clazz, &clazz::getter>(args[1u], nullptr)));
 
     ASSERT_EQ((entt::meta_invoke<clazz, &clazz::get_value>({}, nullptr)).cast<int>(), 3);
-    ASSERT_TRUE((entt::meta_invoke<clazz, &clazz::reset_value>(entt::meta_any{}.context(), {}, nullptr)));
+    ASSERT_TRUE((entt::meta_invoke<clazz, &clazz::reset_value>({}, nullptr)));
     ASSERT_EQ(args[0u].cast<clazz &>().value, 0);
 }