diff options
author | Andrew Morrow <acm@mongodb.com> | 2022-01-04 18:08:01 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-05 21:09:25 +0000 |
commit | 35a20b4134d98e63e22a4879330c03f2f6577ece (patch) | |
tree | 8e04a78ae48bd9796f6bc2394a70fc258e2cad02 | |
parent | 059874fc180489c052fa89d05f8432a949ed0a32 (diff) | |
download | mongo-35a20b4134d98e63e22a4879330c03f2f6577ece.tar.gz |
SERVER-62324 Fix unique_function issues in C++20 mode with VS 2022
-rw-r--r-- | src/mongo/stdx/type_traits.h | 33 | ||||
-rw-r--r-- | src/mongo/util/functional.h | 2 |
2 files changed, 1 insertions, 34 deletions
diff --git a/src/mongo/stdx/type_traits.h b/src/mongo/stdx/type_traits.h index 62438228bba..f7187877b2a 100644 --- a/src/mongo/stdx/type_traits.h +++ b/src/mongo/stdx/type_traits.h @@ -92,39 +92,6 @@ struct conjunction<B> : B {}; template <typename B1, typename... B> struct conjunction<B1, B...> : std::conditional_t<bool(B1::value), stdx::conjunction<B...>, B1> {}; -namespace detail { -template <typename Func, - typename... Args, - typename = typename std::result_of<Func && (Args && ...)>::type> -auto is_invocable_impl(Func&& func, Args&&... args) -> std::true_type; -auto is_invocable_impl(...) -> std::false_type; -} // namespace detail - -template <typename Func, typename... Args> -struct is_invocable - : decltype(detail::is_invocable_impl(std::declval<Func>(), std::declval<Args>()...)) {}; - -namespace detail { - -// This helps solve the lack of regular void problem, when passing a 'conversion target' as a -// parameter. - -template <typename R, - typename Func, - typename... Args, - typename ComputedResult = typename std::result_of<Func && (Args && ...)>::type> -auto is_invocable_r_impl(stdx::type_identity<R>, Func&& func, Args&&... args) -> - typename stdx::disjunction<std::is_void<R>, - std::is_same<ComputedResult, R>, - std::is_convertible<ComputedResult, R>>::type; -auto is_invocable_r_impl(...) -> std::false_type; -} // namespace detail - -template <typename R, typename Func, typename... Args> -struct is_invocable_r - : decltype(detail::is_invocable_r_impl( - stdx::type_identity<R>(), std::declval<Func>(), std::declval<Args>()...)) {}; - } // namespace stdx } // namespace mongo diff --git a/src/mongo/util/functional.h b/src/mongo/util/functional.h index c30089a64e9..ca968ea9ca6 100644 --- a/src/mongo/util/functional.h +++ b/src/mongo/util/functional.h @@ -95,7 +95,7 @@ public: // requirements are met. They must be concrete parameters not template parameters to work // around bugs in some compilers that we presently use. We may be able to revisit this // design after toolchain upgrades for C++17. - std::enable_if_t<stdx::is_invocable_r<RetType, Functor, Args...>::value, TagType> = + std::enable_if_t<std::is_invocable_r<RetType, Functor, Args...>::value, TagType> = makeTag(), std::enable_if_t<std::is_move_constructible<Functor>::value, TagType> = makeTag(), std::enable_if_t<!std::is_same<std::decay_t<Functor>, unique_function>::value, TagType> = |