summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/meta/type_traits.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/absl/meta/type_traits.h b/absl/meta/type_traits.h
index 75689bb6..d5cb5f3b 100644
--- a/absl/meta/type_traits.h
+++ b/absl/meta/type_traits.h
@@ -610,8 +610,22 @@ using common_type_t = typename std::common_type<T...>::type;
template <typename T>
using underlying_type_t = typename std::underlying_type<T>::type;
-template <typename T>
-using result_of_t = typename std::result_of<T>::type;
+
+namespace type_traits_internal {
+
+#if __cplusplus >= 201703L
+// std::result_of is deprecated (C++17) or removed (C++20)
+template<typename> struct result_of;
+template<typename F, typename... Args>
+struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
+#else
+template<typename F> using result_of = std::result_of<F>;
+#endif
+
+} // namespace type_traits_internal
+
+template<typename F>
+using result_of_t = typename type_traits_internal::result_of<F>::type;
namespace type_traits_internal {
// In MSVC we can't probe std::hash or stdext::hash because it triggers a