diff options
author | Abseil Team <absl-team@google.com> | 2020-02-21 12:51:36 -0800 |
---|---|---|
committer | CJ Johnson <johnsoncj@google.com> | 2020-02-21 15:56:04 -0500 |
commit | b69c7d880caddfc25bf348dbcfe9d45fdd8bc6e6 (patch) | |
tree | 0ceef2d75071fdfdf7a47c2978a4df5b422001ed /absl/functional | |
parent | 2a5633fc077a58528cdbfe78720f3f6bfdc6044d (diff) |
Export of internal Abseil changes
--
00f5301405423005d9129935c05f20155536cc1a by CJ Johnson <johnsoncj@google.com>:
Removes usage of std::aligned_storage from Abseil implementation details
PiperOrigin-RevId: 296492301
--
fc11d15f91764612fba080669d2381dc181df52b by Abseil Team <absl-team@google.com>:
Fix absl::bind_front documentation.
PiperOrigin-RevId: 296482945
--
0164c595c129c46bf21ae74eba5399a1da5f140b by Gennadiy Rozental <rogeeff@google.com>:
Automated g4 rollback of changelist 296320700.
PiperOrigin-RevId: 296439968
--
1eb295700758ca0894d872b2de7c675b4ad679af by Abseil Team <absl-team@google.com>:
Removes duplicate comments.
PiperOrigin-RevId: 296433214
--
c30c01caae02d2fa4ef783d988de6bebb9757c39 by Derek Mauro <dmauro@google.com>:
Merge GitHub #621: Add RISCV support to GetProgramCounter()
Fixes #621
PiperOrigin-RevId: 296351174
--
95d4498167596fd7543e025bdfe9a8da9e2ca3c8 by Abseil Team <absl-team@google.com>:
Automated g4 rollback of changelist 296320700.
PiperOrigin-RevId: 296348701
--
b193f0543e0cec54dddb2ed51f45dc489c8d06d5 by Gennadiy Rozental <rogeeff@google.com>:
Change TryParse interface to return managed value.
In addition introduce companion StoreValue routine which consumes pointer to source value and stores the value inside of FlagImpl. In a follow up CL we will change StoreValue implementation to behave differently depending on "value storage kind".
We also rename default_src_ to default_value_.
PiperOrigin-RevId: 296320700
--
57e942b485d12912a0a8d0d0b35fa2a62847020f by Derek Mauro <dmauro@google.com>:
Merge GitHub #622
* Add missing #ifdef conditionals for ABSL_HAVE_VDSO_SUPPORT
PiperOrigin-RevId: 296272830
GitOrigin-RevId: 00f5301405423005d9129935c05f20155536cc1a
Change-Id: I1b05eeaf1280f95fb0a2c5f3654995a87c792893
Diffstat (limited to 'absl/functional')
-rw-r--r-- | absl/functional/bind_front.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/absl/functional/bind_front.h b/absl/functional/bind_front.h index 8448d7b3..5b47970e 100644 --- a/absl/functional/bind_front.h +++ b/absl/functional/bind_front.h @@ -38,9 +38,7 @@ ABSL_NAMESPACE_BEGIN // bind_front() // -// Binds the first N arguments of an invocable object and stores them by value, -// except types of `std::reference_wrapper` which are 'unwound' and stored by -// reference. +// Binds the first N arguments of an invocable object and stores them by value. // // Like `std::bind()`, `absl::bind_front()` is implicitly convertible to // `std::function`. In particular, it may be used as a simpler replacement for @@ -140,7 +138,9 @@ ABSL_NAMESPACE_BEGIN // // Example: Storing bound arguments by reference. // -// void Print(const string& a, const string& b) { LOG(INFO) << a << b; } +// void Print(const std::string& a, const std::string& b) { +// std::cerr << a << b; +// } // // std::string hi = "Hello, "; // std::vector<std::string> names = {"Chuk", "Gek"}; @@ -152,6 +152,24 @@ ABSL_NAMESPACE_BEGIN // // dangling references. // foo->DoInFuture(absl::bind_front(Print, std::ref(hi), "Guest")); // BAD! // auto f = absl::bind_front(Print, std::ref(hi), "Guest"); // BAD! +// +// Example: Storing reference-like types. +// +// void Print(absl::string_view a, const std::string& b) { +// std::cerr << a << b; +// } +// +// std::string hi = "Hello, "; +// // Copies "hi". +// absl::bind_front(Print, hi)("Chuk"); +// +// // Compile error: std::reference_wrapper<const string> is not implicitly +// // convertible to string_view. +// // absl::bind_front(Print, std::cref(hi))("Chuk"); +// +// // Doesn't copy "hi". +// absl::bind_front(Print, absl::string_view(hi))("Chuk"); +// template <class F, class... BoundArgs> constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( F&& func, BoundArgs&&... args) { |