diff options
author | Abseil Team <absl-team@google.com> | 2022-02-23 14:30:26 -0800 |
---|---|---|
committer | rogeeff <rogeeff@google.com> | 2022-02-24 12:28:55 -0500 |
commit | 5e4ea1ce097f3571e7d87af33b6b30d11b3a211e (patch) | |
tree | 62fbf34f7e310a9ef6602acee8fa7d61ae32df09 /absl/functional | |
parent | 0ad7994f10624cd1538b1287e56cae5ac9c0cb40 (diff) |
Export of internal Abseil changes
--
7473df9e4922c589f6b27cf546aad097381ae552 by Martijn Vels <mvels@google.com>:
Make ABSL_ASSUME publicly available
PiperOrigin-RevId: 430540224
Change-Id: I760e2d86e3a0b676cd2a6d26e0225a77381e948f
--
c83e38bc421f715b3c1e20150c2f1ffe8e633028 by Abseil Team <absl-team@google.com>:
Alias absl::bind_front to std::bind_front if available
This avoids ambiguity between the two when enabling C++20.
PiperOrigin-RevId: 430486679
GitOrigin-RevId: 7473df9e4922c589f6b27cf546aad097381ae552
Change-Id: I1e9bba09a8946480ce10ddd28e86b6c86191d38c
Diffstat (limited to 'absl/functional')
-rw-r--r-- | absl/functional/bind_front.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/absl/functional/bind_front.h b/absl/functional/bind_front.h index 5b47970e..f9075bd1 100644 --- a/absl/functional/bind_front.h +++ b/absl/functional/bind_front.h @@ -30,6 +30,10 @@ #ifndef ABSL_FUNCTIONAL_BIND_FRONT_H_ #define ABSL_FUNCTIONAL_BIND_FRONT_H_ +#if defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L +#include <functional> // For std::bind_front. +#endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L + #include "absl/functional/internal/front_binder.h" #include "absl/utility/utility.h" @@ -46,7 +50,8 @@ ABSL_NAMESPACE_BEGIN // specified. More importantly, it provides more reliable correctness guarantees // than `std::bind()`; while `std::bind()` will silently ignore passing more // parameters than expected, for example, `absl::bind_front()` will report such -// mis-uses as errors. +// mis-uses as errors. In C++20, `absl::bind_front` is replaced by +// `std::bind_front`. // // absl::bind_front(a...) can be seen as storing the results of // std::make_tuple(a...). @@ -170,6 +175,9 @@ ABSL_NAMESPACE_BEGIN // // Doesn't copy "hi". // absl::bind_front(Print, absl::string_view(hi))("Chuk"); // +#if defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L +using std::bind_front; +#else // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L template <class F, class... BoundArgs> constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( F&& func, BoundArgs&&... args) { @@ -177,6 +185,7 @@ constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( absl::in_place, absl::forward<F>(func), absl::forward<BoundArgs>(args)...); } +#endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L ABSL_NAMESPACE_END } // namespace absl |