Просмотр исходного кода

meta: deprecate meta_any_policy and meta_any::policy

Michele Caini 1 год назад
Родитель
Сommit
50216fb896
2 измененных файлов с 9 добавлено и 9 удалено
  1. 4 4
      src/entt/meta/meta.hpp
  2. 5 5
      test/entt/meta/meta_any.cpp

+ 4 - 4
src/entt/meta/meta.hpp

@@ -160,7 +160,7 @@ private:
 };
 
 /*! @brief Possible modes of a meta any object. */
-using meta_any_policy = any_policy;
+using meta_any_policy [[deprecated("use any_policy instead")]] = any_policy;
 
 /*! @brief Opaque wrapper for values of any type. */
 class meta_any {
@@ -524,7 +524,7 @@ 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, storage.policy() == any_policy::cref, *this, &proxy);
         return proxy;
     }
 
@@ -541,7 +541,7 @@ 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, storage.policy() == any_policy::cref, *this, &proxy);
         return proxy;
     }
 
@@ -595,7 +595,7 @@ public:
      * @brief Returns the current mode of a meta any object.
      * @return The current mode of the meta any object.
      */
-    [[nodiscard]] meta_any_policy policy() const noexcept {
+    [[nodiscard]] [[deprecated("use ::base().policy() instead")]] any_policy policy() const noexcept {
         return storage.policy();
     }
 

+ 5 - 5
test/entt/meta/meta_any.cpp

@@ -181,7 +181,7 @@ TEST_F(MetaAny, SBOAsRefConstruction) {
 
     ASSERT_TRUE(any);
     ASSERT_FALSE(any.base().owner());
-    ASSERT_EQ(any.policy(), entt::meta_any_policy::ref);
+    ASSERT_EQ(any.base().policy(), entt::any_policy::ref);
     ASSERT_EQ(any.type(), entt::resolve<int>());
 
     ASSERT_FALSE(any.try_cast<std::size_t>());
@@ -218,7 +218,7 @@ TEST_F(MetaAny, SBOAsConstRefConstruction) {
 
     ASSERT_TRUE(any);
     ASSERT_FALSE(any.base().owner());
-    ASSERT_EQ(any.policy(), entt::meta_any_policy::cref);
+    ASSERT_EQ(any.base().policy(), entt::any_policy::cref);
     ASSERT_EQ(any.type(), entt::resolve<int>());
 
     ASSERT_FALSE(any.try_cast<std::size_t>());
@@ -474,7 +474,7 @@ TEST_F(MetaAny, NoSBOAsRefConstruction) {
 
     ASSERT_TRUE(any);
     ASSERT_FALSE(any.base().owner());
-    ASSERT_EQ(any.policy(), entt::meta_any_policy::ref);
+    ASSERT_EQ(any.base().policy(), entt::any_policy::ref);
     ASSERT_EQ(any.type(), entt::resolve<fat>());
 
     ASSERT_FALSE(any.try_cast<std::size_t>());
@@ -509,7 +509,7 @@ TEST_F(MetaAny, NoSBOAsConstRefConstruction) {
 
     ASSERT_TRUE(any);
     ASSERT_FALSE(any.base().owner());
-    ASSERT_EQ(any.policy(), entt::meta_any_policy::cref);
+    ASSERT_EQ(any.base().policy(), entt::any_policy::cref);
     ASSERT_EQ(any.type(), entt::resolve<fat>());
 
     ASSERT_FALSE(any.try_cast<std::size_t>());
@@ -772,7 +772,7 @@ TEST_F(MetaAny, VoidInPlaceTypeConstruction) {
 
     ASSERT_TRUE(any);
     ASSERT_FALSE(any.base().owner());
-    ASSERT_EQ(any.policy(), entt::meta_any_policy::empty);
+    ASSERT_EQ(any.base().policy(), entt::any_policy::empty);
     ASSERT_FALSE(any.try_cast<char>());
     ASSERT_EQ(any.data(), nullptr);
     ASSERT_EQ(any.type(), entt::resolve<void>());