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

meta_func::meta is no longer available

Michele Caini 6 лет назад
Родитель
Сommit
cf0e4d24a1
2 измененных файлов с 9 добавлено и 21 удалено
  1. 0 3
      src/entt/meta/factory.hpp
  2. 9 18
      src/entt/meta/meta.hpp

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

@@ -690,9 +690,6 @@ public:
             &helper_type::arg,
             &helper_type::arg,
             [](meta_handle handle, meta_any *any) {
             [](meta_handle handle, meta_any *any) {
                 return internal::invoke<Type, Candidate, Policy>(handle, any, std::make_index_sequence<helper_type::size>{});
                 return internal::invoke<Type, Candidate, Policy>(handle, any, std::make_index_sequence<helper_type::size>{});
-            },
-            []() ENTT_NOEXCEPT -> meta_func {
-                return &node;
             }
             }
         };
         };
 
 

+ 9 - 18
src/entt/meta/meta.hpp

@@ -17,7 +17,6 @@ namespace entt {
 class meta_any;
 class meta_any;
 class meta_handle;
 class meta_handle;
 class meta_prop;
 class meta_prop;
-class meta_func;
 class meta_type;
 class meta_type;
 
 
 
 
@@ -99,7 +98,6 @@ struct meta_func_node {
     meta_type_node *(* const ret)() ENTT_NOEXCEPT;
     meta_type_node *(* const ret)() ENTT_NOEXCEPT;
     meta_type_node *(* const arg)(size_type) ENTT_NOEXCEPT;
     meta_type_node *(* const arg)(size_type) ENTT_NOEXCEPT;
     meta_any(* const invoke)(meta_handle, meta_any *);
     meta_any(* const invoke)(meta_handle, meta_any *);
-    meta_func(* const meta)() ENTT_NOEXCEPT;
 };
 };
 
 
 
 
@@ -1311,21 +1309,16 @@ inline bool operator!=(const meta_data &lhs, const meta_data &rhs) ENTT_NOEXCEPT
  * A meta function is an opaque container for a member function associated with
  * A meta function is an opaque container for a member function associated with
  * a given type.
  * a given type.
  */
  */
-class meta_func {
-    /*! @brief A meta factory is allowed to create meta objects. */
-    template<typename> friend class meta_factory;
-
-    meta_func(const internal::meta_func_node *curr) ENTT_NOEXCEPT
-        : node{curr}
-    {}
-
-public:
+struct meta_func {
     /*! @brief Unsigned integer type. */
     /*! @brief Unsigned integer type. */
     using size_type = typename internal::meta_func_node::size_type;
     using size_type = typename internal::meta_func_node::size_type;
 
 
-    /*! @brief Default constructor. */
-    meta_func() ENTT_NOEXCEPT
-        : node{nullptr}
+    /**
+     * @brief Constructs an instance from a given node.
+     * @param curr The underlying node with which to construct the instance.
+     */
+    meta_func(const internal::meta_func_node *curr = nullptr) ENTT_NOEXCEPT
+        : node{curr}
     {}
     {}
 
 
     /**
     /**
@@ -1762,7 +1755,7 @@ public:
     std::enable_if_t<std::is_invocable_v<Op, meta_func>, void>
     std::enable_if_t<std::is_invocable_v<Op, meta_func>, void>
     func(Op op) const ENTT_NOEXCEPT {
     func(Op op) const ENTT_NOEXCEPT {
         internal::iterate<&internal::meta_type_node::func>([op = std::move(op)](auto *curr) {
         internal::iterate<&internal::meta_type_node::func>([op = std::move(op)](auto *curr) {
-            op(curr->meta());
+            op(meta_func{curr});
         }, node);
         }, node);
     }
     }
 
 
@@ -1777,11 +1770,9 @@ public:
      * @return The meta function associated with the given identifier, if any.
      * @return The meta function associated with the given identifier, if any.
      */
      */
     meta_func func(const ENTT_ID_TYPE identifier) const ENTT_NOEXCEPT {
     meta_func func(const ENTT_ID_TYPE identifier) const ENTT_NOEXCEPT {
-        const auto * const curr = internal::find_if<&internal::meta_type_node::func>([identifier](auto *candidate) {
+        return internal::find_if<&internal::meta_type_node::func>([identifier](auto *candidate) {
             return candidate->identifier == identifier;
             return candidate->identifier == identifier;
         }, node);
         }, node);
-
-        return curr ? curr->meta() : meta_func{};
     }
     }
 
 
     /**
     /**