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
pull/1157/head
Abseil Team 3 years ago committed by dinord
parent 9fed77a6fe
commit e854df09df
  1. 23
      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_

Loading…
Cancel
Save