Răsfoiți Sursa

stl: std::is_function_v

skypjack 1 zi în urmă
părinte
comite
ed026bbc7e

+ 1 - 1
src/entt/core/any.hpp

@@ -88,7 +88,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
             }
             }
             break;
             break;
         case compare:
         case compare:
-            if constexpr(!std::is_function_v<Type> && !std::is_array_v<Type> && is_equality_comparable_v<Type>) {
+            if constexpr(!stl::is_function_v<Type> && !std::is_array_v<Type> && is_equality_comparable_v<Type>) {
                 return (*elem == *static_cast<const Type *>(other)) ? other : nullptr;
                 return (*elem == *static_cast<const Type *>(other)) ? other : nullptr;
             } else {
             } else {
                 return (elem == other) ? other : nullptr;
                 return (elem == other) ? other : nullptr;

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

@@ -202,7 +202,7 @@ class meta_any {
                     }
                     }
                 } else if constexpr(!std::is_array_v<Type> && !stl::is_void_v<stl::remove_const_t<stl::remove_pointer_t<Type>>>) {
                 } else if constexpr(!std::is_array_v<Type> && !stl::is_void_v<stl::remove_const_t<stl::remove_pointer_t<Type>>>) {
                     if(auto *pointer = any_cast<Type>(value.storage); pointer) {
                     if(auto *pointer = any_cast<Type>(value.storage); pointer) {
-                        static_cast<meta_any *>(other)->emplace<std::conditional_t<std::is_function_v<stl::remove_const_t<stl::remove_pointer_t<Type>>>, Type, stl::remove_pointer_t<Type> &>>(*pointer);
+                        static_cast<meta_any *>(other)->emplace<std::conditional_t<stl::is_function_v<stl::remove_const_t<stl::remove_pointer_t<Type>>>, Type, stl::remove_pointer_t<Type> &>>(*pointer);
                     }
                     }
                 }
                 }
             }
             }

+ 1 - 1
src/entt/meta/node.hpp

@@ -244,7 +244,7 @@ auto setup_node_for() noexcept {
         };
         };
     }
     }
 
 
-    if constexpr(!stl::is_void_v<Type> && !std::is_function_v<Type>) {
+    if constexpr(!stl::is_void_v<Type> && !stl::is_function_v<Type>) {
         node.from_void = +[](const meta_ctx &ctx, void *elem, const void *celem) {
         node.from_void = +[](const meta_ctx &ctx, void *elem, const void *celem) {
             if(elem && celem) { // ownership construction request
             if(elem && celem) { // ownership construction request
                 return meta_any{ctx, std::in_place, static_cast<stl::decay_t<Type> *>(elem)};
                 return meta_any{ctx, std::in_place, static_cast<stl::decay_t<Type> *>(elem)};

+ 2 - 2
src/entt/meta/utility.hpp

@@ -275,7 +275,7 @@ template<typename Type>
  */
  */
 template<typename Type, auto Data>
 template<typename Type, auto Data>
 [[nodiscard]] bool meta_setter([[maybe_unused]] meta_handle instance, [[maybe_unused]] meta_any value) {
 [[nodiscard]] bool meta_setter([[maybe_unused]] meta_handle instance, [[maybe_unused]] meta_any value) {
-    if constexpr(std::is_member_function_pointer_v<decltype(Data)> || std::is_function_v<stl::remove_reference_t<stl::remove_pointer_t<decltype(Data)>>>) {
+    if constexpr(std::is_member_function_pointer_v<decltype(Data)> || stl::is_function_v<stl::remove_reference_t<stl::remove_pointer_t<decltype(Data)>>>) {
         using descriptor = meta_function_helper_t<Type, decltype(Data)>;
         using descriptor = meta_function_helper_t<Type, decltype(Data)>;
         using data_type = type_list_element_t<descriptor::is_static, typename descriptor::args_type>;
         using data_type = type_list_element_t<descriptor::is_static, typename descriptor::args_type>;
 
 
@@ -316,7 +316,7 @@ template<typename Type, auto Data>
  */
  */
 template<typename Type, auto Data, meta_policy Policy = as_value_t>
 template<typename Type, auto Data, meta_policy Policy = as_value_t>
 [[nodiscard]] meta_any meta_getter(meta_handle instance) {
 [[nodiscard]] meta_any meta_getter(meta_handle instance) {
-    if constexpr(std::is_member_pointer_v<decltype(Data)> || std::is_function_v<stl::remove_reference_t<stl::remove_pointer_t<decltype(Data)>>>) {
+    if constexpr(std::is_member_pointer_v<decltype(Data)> || stl::is_function_v<stl::remove_reference_t<stl::remove_pointer_t<decltype(Data)>>>) {
         if constexpr(!std::is_array_v<stl::remove_cvref_t<stl::invoke_result_t<decltype(Data), Type &>>>) {
         if constexpr(!std::is_array_v<stl::remove_cvref_t<stl::invoke_result_t<decltype(Data), Type &>>>) {
             if constexpr(std::is_invocable_v<decltype(Data), Type &>) {
             if constexpr(std::is_invocable_v<decltype(Data), Type &>) {
                 if(auto *clazz = instance->try_cast<Type>(); clazz) {
                 if(auto *clazz = instance->try_cast<Type>(); clazz) {

+ 3 - 3
src/entt/poly/poly.hpp

@@ -76,7 +76,7 @@ class poly_vtable {
     [[nodiscard]] static ENTT_CONSTEVAL auto make_vtable(type_list<Func...>) noexcept {
     [[nodiscard]] static ENTT_CONSTEVAL auto make_vtable(type_list<Func...>) noexcept {
         if constexpr(sizeof...(Func) == 0u) {
         if constexpr(sizeof...(Func) == 0u) {
             return decltype(make_vtable(typename Concept::template impl<inspector>{})){};
             return decltype(make_vtable(typename Concept::template impl<inspector>{})){};
-        } else if constexpr((std::is_function_v<Func> && ...)) {
+        } else if constexpr((stl::is_function_v<Func> && ...)) {
             return decltype(stl::make_tuple(vtable_entry(stl::declval<Func inspector::*>())...)){};
             return decltype(stl::make_tuple(vtable_entry(stl::declval<Func inspector::*>())...)){};
         }
         }
     }
     }
@@ -143,7 +143,7 @@ struct poly_base {
     [[nodiscard]] decltype(auto) invoke(const poly_base &self, Args &&...args) const {
     [[nodiscard]] decltype(auto) invoke(const poly_base &self, Args &&...args) const {
         const auto &poly = static_cast<const Poly &>(self);
         const auto &poly = static_cast<const Poly &>(self);
 
 
-        if constexpr(std::is_function_v<stl::remove_pointer_t<decltype(poly.vtable)>>) {
+        if constexpr(stl::is_function_v<stl::remove_pointer_t<decltype(poly.vtable)>>) {
             return poly.vtable(poly.storage, stl::forward<Args>(args)...);
             return poly.vtable(poly.storage, stl::forward<Args>(args)...);
         } else {
         } else {
             return std::get<Member>(*poly.vtable)(poly.storage, stl::forward<Args>(args)...);
             return std::get<Member>(*poly.vtable)(poly.storage, stl::forward<Args>(args)...);
@@ -155,7 +155,7 @@ struct poly_base {
     [[nodiscard]] decltype(auto) invoke(poly_base &self, Args &&...args) {
     [[nodiscard]] decltype(auto) invoke(poly_base &self, Args &&...args) {
         auto &poly = static_cast<Poly &>(self);
         auto &poly = static_cast<Poly &>(self);
 
 
-        if constexpr(std::is_function_v<stl::remove_pointer_t<decltype(poly.vtable)>>) {
+        if constexpr(stl::is_function_v<stl::remove_pointer_t<decltype(poly.vtable)>>) {
             static_assert(Member == 0u, "Unknown member");
             static_assert(Member == 0u, "Unknown member");
             return poly.vtable(poly.storage, stl::forward<Args>(args)...);
             return poly.vtable(poly.storage, stl::forward<Args>(args)...);
         } else {
         } else {

+ 1 - 0
src/entt/stl/type_traits.hpp

@@ -13,6 +13,7 @@ using std::is_aggregate_v;
 using std::is_const_v;
 using std::is_const_v;
 using std::is_copy_assignable_v;
 using std::is_copy_assignable_v;
 using std::is_default_constructible_v;
 using std::is_default_constructible_v;
+using std::is_function_v;
 using std::is_invocable_r_v;
 using std::is_invocable_r_v;
 using std::is_lvalue_reference_v;
 using std::is_lvalue_reference_v;
 using std::is_member_object_pointer_v;
 using std::is_member_object_pointer_v;