Commit e854df09 by Abseil Team Committed by dinord

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
parent 9fed77a6
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
// //
// absl::base_internal::invoke(f, args...) is an implementation of // absl::base_internal::invoke(f, args...) is an implementation of
// INVOKE(f, args...) from section [func.require] of the C++ standard. // 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] // [func.require]
// Define INVOKE (f, t1, t2, ..., tN) as follows: // Define INVOKE (f, t1, t2, ..., tN) as follows:
...@@ -35,6 +37,25 @@ ...@@ -35,6 +37,25 @@
#ifndef ABSL_BASE_INTERNAL_INVOKE_H_ #ifndef ABSL_BASE_INTERNAL_INVOKE_H_
#define 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 <algorithm>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
...@@ -184,4 +205,6 @@ invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) { ...@@ -184,4 +205,6 @@ invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) {
ABSL_NAMESPACE_END ABSL_NAMESPACE_END
} // namespace absl } // namespace absl
#endif // __cplusplus >= 201703L
#endif // ABSL_BASE_INTERNAL_INVOKE_H_ #endif // ABSL_BASE_INTERNAL_INVOKE_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment