summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-04-06 10:44:58 -0700
committerGravatar dinord <dino.radakovich@gmail.com>2022-04-07 15:42:56 -0400
commite854df09dfcb35056c1d42420028648ee0ebebaf (patch)
tree27d742dadffa404422135db8f455396e47b9a801
parent9fed77a6fea29b8c8468bd41c6259c7f67163a65 (diff)
Export of internal Abseil changes
-- 0c8848ebedc07470c7ab647a5bb8949481540ce9 by Dino Radakovic <dinor@google.com>: Define absl::base_internal::invoke using std::invoke when C++ >= 17 PiperOrigin-RevId: 439880834 Change-Id: I3622fcf473501d54c57575118a11d54c19573446 GitOrigin-RevId: 0c8848ebedc07470c7ab647a5bb8949481540ce9
-rw-r--r--absl/base/internal/invoke.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/absl/base/internal/invoke.h b/absl/base/internal/invoke.h
index 5c71f328..e9efb2fc 100644
--- a/absl/base/internal/invoke.h
+++ b/absl/base/internal/invoke.h
@@ -14,6 +14,8 @@
//
// absl::base_internal::invoke(f, args...) is an implementation of
// INVOKE(f, args...) from section [func.require] of the C++ standard.
+// When compiled as C++17 and later versions, it is implemented as an alias of
+// std::invoke.
//
// [func.require]
// Define INVOKE (f, t1, t2, ..., tN) as follows:
@@ -35,6 +37,25 @@
#ifndef ABSL_BASE_INTERNAL_INVOKE_H_
#define ABSL_BASE_INTERNAL_INVOKE_H_
+#include "absl/base/config.h"
+
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+
+#include <functional>
+
+namespace absl {
+ABSL_NAMESPACE_BEGIN
+namespace base_internal {
+
+using std::invoke;
+using std::invoke_result_t;
+
+} // namespace base_internal
+ABSL_NAMESPACE_END
+} // namespace absl
+
+#else // __cplusplus >= 201703L
+
#include <algorithm>
#include <type_traits>
#include <utility>
@@ -184,4 +205,6 @@ invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) {
ABSL_NAMESPACE_END
} // namespace absl
+#endif // __cplusplus >= 201703L
+
#endif // ABSL_BASE_INTERNAL_INVOKE_H_