소스 검색

meta: shared meta_object<Type>::custom()

skypjack 2 일 전
부모
커밋
e348df68c6
1개의 변경된 파일과 9개의 추가작업 그리고 18개의 파일을 삭제
  1. 9 18
      src/entt/meta/meta.hpp

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

@@ -830,6 +830,15 @@ public:
         }
         }
     }
     }
 
 
+    /**
+     * @brief Returns user defined data for a given meta object.
+     * @return User defined arbitrary data.
+     */
+    [[nodiscard]] meta_custom custom() const noexcept
+    requires requires(node_type elem) { elem.custom; } {
+        return node_or_assert().custom;
+    }
+
     /*! @copydoc meta_any::context */
     /*! @copydoc meta_any::context */
     [[nodiscard]] const meta_ctx &context() const noexcept {
     [[nodiscard]] const meta_ctx &context() const noexcept {
         return *ctx;
         return *ctx;
@@ -936,14 +945,6 @@ struct meta_data final: meta_object<internal::meta_data_node> {
     [[nodiscard]] Type traits() const noexcept {
     [[nodiscard]] Type traits() const noexcept {
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
     }
     }
-
-    /**
-     * @brief Returns user defined data for a given meta object.
-     * @return User defined arbitrary data.
-     */
-    [[nodiscard]] meta_custom custom() const noexcept {
-        return node_or_assert().custom;
-    }
 };
 };
 
 
 /*! @brief Opaque wrapper for member functions. */
 /*! @brief Opaque wrapper for member functions. */
@@ -1014,11 +1015,6 @@ struct meta_func final: meta_object<internal::meta_func_node> {
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
     }
     }
 
 
-    /*! @copydoc meta_data::custom */
-    [[nodiscard]] meta_custom custom() const noexcept {
-        return node_or_assert().custom;
-    }
-
     /**
     /**
      * @brief Returns the next overload of a given function, if any.
      * @brief Returns the next overload of a given function, if any.
      * @return The next overload of the given function, if any.
      * @return The next overload of the given function, if any.
@@ -1432,11 +1428,6 @@ public:
     [[nodiscard]] Type traits() const noexcept {
     [[nodiscard]] Type traits() const noexcept {
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
         return internal::meta_to_user_traits<Type>(node_or_assert().traits);
     }
     }
-
-    /*! @copydoc meta_data::custom */
-    [[nodiscard]] meta_custom custom() const noexcept {
-        return node_or_assert().custom;
-    }
 };
 };
 
 
 [[nodiscard]] inline meta_type meta_any::type() const noexcept {
 [[nodiscard]] inline meta_type meta_any::type() const noexcept {