Przeglądaj źródła

workaround for an issue of MSVC (close #373)

Michele Caini 6 lat temu
rodzic
commit
9ffa372ba2
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      src/entt/meta/factory.hpp

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

@@ -90,7 +90,7 @@ bool setter([[maybe_unused]] meta_handle handle, [[maybe_unused]] meta_any index
     bool accepted = false;
     bool accepted = false;
 
 
     if constexpr(!Const) {
     if constexpr(!Const) {
-        if constexpr(std::is_function_v<std::remove_pointer_t<decltype(Data)>> || std::is_member_function_pointer_v<decltype(Data)>) {
+        if constexpr(std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>> || std::is_member_function_pointer_v<decltype(Data)>) {
             using helper_type = meta_function_helper_t<decltype(Data)>;
             using helper_type = meta_function_helper_t<decltype(Data)>;
             using data_type = std::tuple_element_t<!std::is_member_function_pointer_v<decltype(Data)>, typename helper_type::args_type>;
             using data_type = std::tuple_element_t<!std::is_member_function_pointer_v<decltype(Data)>, typename helper_type::args_type>;
             static_assert(std::is_invocable_v<decltype(Data), Type &, data_type>);
             static_assert(std::is_invocable_v<decltype(Data), Type &, data_type>);
@@ -164,7 +164,7 @@ meta_any getter([[maybe_unused]] meta_handle handle, [[maybe_unused]] meta_any i
         }
         }
     };
     };
 
 
-    if constexpr(std::is_function_v<std::remove_pointer_t<decltype(Data)>> || std::is_member_function_pointer_v<decltype(Data)>) {
+    if constexpr(std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>> || std::is_member_function_pointer_v<decltype(Data)>) {
         static_assert(std::is_invocable_v<decltype(Data), Type &>);
         static_assert(std::is_invocable_v<decltype(Data), Type &>);
         auto * const clazz = meta_any{handle}.try_cast<Type>();
         auto * const clazz = meta_any{handle}.try_cast<Type>();
         return clazz ? dispatch(std::invoke(Data, *clazz)) : meta_any{};
         return clazz ? dispatch(std::invoke(Data, *clazz)) : meta_any{};
@@ -218,7 +218,7 @@ meta_any invoke([[maybe_unused]] meta_handle handle, meta_any *args, std::index_
         return instance;
         return instance;
     }(args+Indexes, (args+Indexes)->try_cast<std::tuple_element_t<Indexes, typename helper_type::args_type>>())...);
     }(args+Indexes, (args+Indexes)->try_cast<std::tuple_element_t<Indexes, typename helper_type::args_type>>())...);
 
 
-    if constexpr(std::is_function_v<std::remove_pointer_t<decltype(Candidate)>>) {
+    if constexpr(std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Candidate)>>>) {
         return (std::get<Indexes>(direct) && ...) ? dispatch(std::get<Indexes>(direct)...) : meta_any{};
         return (std::get<Indexes>(direct) && ...) ? dispatch(std::get<Indexes>(direct)...) : meta_any{};
     } else {
     } else {
         auto * const clazz = meta_any{handle}.try_cast<Type>();
         auto * const clazz = meta_any{handle}.try_cast<Type>();