Răsfoiți Sursa

meta_conv::meta is no longer available

Michele Caini 6 ani în urmă
părinte
comite
818998c532
2 a modificat fișierele cu 8 adăugiri și 23 ștergeri
  1. 0 6
      src/entt/meta/factory.hpp
  2. 8 17
      src/entt/meta/meta.hpp

+ 0 - 6
src/entt/meta/factory.hpp

@@ -367,9 +367,6 @@ public:
             &internal::meta_info<To>::resolve,
             [](const void *instance) -> meta_any {
                 return static_cast<To>(*static_cast<const Type *>(instance));
-            },
-            []() ENTT_NOEXCEPT -> meta_conv {
-                return &node;
             }
         };
 
@@ -403,9 +400,6 @@ public:
             &internal::meta_info<conv_type>::resolve,
             [](const void *instance) -> meta_any {
                 return std::invoke(Candidate, *static_cast<const Type *>(instance));
-            },
-            []() ENTT_NOEXCEPT -> meta_conv {
-                return &node;
             }
         };
 

+ 8 - 17
src/entt/meta/meta.hpp

@@ -18,7 +18,6 @@ class meta_any;
 class meta_handle;
 class meta_prop;
 class meta_base;
-class meta_conv;
 class meta_ctor;
 class meta_dtor;
 class meta_data;
@@ -60,7 +59,6 @@ struct meta_conv_node {
     meta_conv_node * next;
     meta_type_node *(* const type)() ENTT_NOEXCEPT;
     meta_any(* const conv)(const void *);
-    meta_conv(* const meta)() ENTT_NOEXCEPT;
 };
 
 
@@ -876,20 +874,15 @@ inline bool operator!=(const meta_base &lhs, const meta_base &rhs) ENTT_NOEXCEPT
  * A meta conversion function is an opaque container for a conversion function
  * to be used to convert a given instance to another type.
  */
-class meta_conv {
-    /*! @brief A meta factory is allowed to create meta objects. */
-    template<typename> friend class meta_factory;
-
-    meta_conv(const internal::meta_conv_node *curr) ENTT_NOEXCEPT
+struct meta_conv {
+    /**
+     * @brief Constructs an instance from the given node.
+     * @param curr A valid node that fits the purpose, if any.
+     */
+    meta_conv(const internal::meta_conv_node *curr = nullptr) ENTT_NOEXCEPT
         : node{curr}
     {}
 
-public:
-    /*! @brief Default constructor. */
-    meta_conv() ENTT_NOEXCEPT
-        : node{nullptr}
-    {}
-
     /**
      * @brief Returns the meta type to which a meta conversion function belongs.
      * @return The meta type to which the meta conversion function belongs.
@@ -1701,7 +1694,7 @@ public:
     template<typename Op>
     void conv(Op op) const ENTT_NOEXCEPT {
         internal::iterate<&internal::meta_type_node::conv>([op = std::move(op)](auto *curr) {
-            op(curr->meta());
+            op(meta_conv{curr});
         }, node);
     }
 
@@ -1717,11 +1710,9 @@ public:
      */
     template<typename Type>
     meta_conv conv() const ENTT_NOEXCEPT {
-        const auto * const curr = internal::find_if<&internal::meta_type_node::conv>([type = internal::meta_info<Type>::resolve()](auto *candidate) {
+        return internal::find_if<&internal::meta_type_node::conv>([type = internal::meta_info<Type>::resolve()](auto *candidate) {
             return candidate->type() == type;
         }, node);
-
-        return curr ? curr->meta() : meta_conv{};
     }
 
     /**