diff options
author | Abseil Team <absl-team@google.com> | 2022-03-31 09:48:42 -0700 |
---|---|---|
committer | rogeeff <rogeeff@google.com> | 2022-03-31 13:13:52 -0400 |
commit | 4dcae40a07e30cbc99d4130e590047000e5fda0b (patch) | |
tree | dfbc80a389e6d07807c3a9ad3ab5c5a2940de563 /absl/strings/str_join.h | |
parent | b9ad9bbfed92199a1a58504306d026cd2597539e (diff) |
Export of internal Abseil changes
--
b984c7c1cbee4253192c833046bfcfa16dca8ccf by Dino Radakovic <dinor@google.com>:
Restrict visibility of absl/flags:commandlineflag_internal
PiperOrigin-RevId: 438591894
Change-Id: I12a6392b2c7f9f1263c741dfd6c43ae22e903aad
--
81315601aab70bb6ac2d17655a727d7f9ee2ff95 by Justin Lebar <jlebar@google.com>:
Update example in str_join.h to use a lambda.
PiperOrigin-RevId: 438390035
Change-Id: Icc707b972e5a369a71ad774004fdf0a17a9b33a7
--
1c3c7921224e505faca8617b073f657d3737219f by Dino Radakovic <dinor@google.com>:
Internal change
PiperOrigin-RevId: 438386036
Change-Id: I6066da1b5a1ddf5af265944a31ed298297b4f2e1
--
2d6885f78481f04e0e7ee86060aec15b677144f3 by Abseil Team <absl-team@google.com>:
Internal change
PiperOrigin-RevId: 438378389
Change-Id: If70dd9114114eb44e85afccd521e7fb7e1436b88
--
7f8282ddee7fcd032e01cbfe65c11c2d166cceb8 by Derek Mauro <dmauro@google.com>:
Internal change
PiperOrigin-RevId: 438374554
Change-Id: I993367952af1dc83bd5aa0ae19a64c024f457fdd
--
ce65ba28f6031e45db8fa5118a05410f5166fd7a by Abseil Team <absl-team@google.com>:
Spelling gardening: Heterogeneous has an "e" after the "n".
PiperOrigin-RevId: 438374411
Change-Id: If1a9098a5d04338837998883739c7b555efa62b4
GitOrigin-RevId: b984c7c1cbee4253192c833046bfcfa16dca8ccf
Diffstat (limited to 'absl/strings/str_join.h')
-rw-r--r-- | absl/strings/str_join.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/absl/strings/str_join.h b/absl/strings/str_join.h index 33534536..ee5ae7ef 100644 --- a/absl/strings/str_join.h +++ b/absl/strings/str_join.h @@ -72,21 +72,15 @@ ABSL_NAMESPACE_BEGIN // functions. You may provide your own Formatter to enable `absl::StrJoin()` to // work with arbitrary types. // -// The following is an example of a custom Formatter that simply uses -// `std::to_string()` to format an integer as a std::string. -// -// struct MyFormatter { -// void operator()(std::string* out, int i) const { -// out->append(std::to_string(i)); -// } -// }; -// -// You would use the above formatter by passing an instance of it as the final -// argument to `absl::StrJoin()`: -// -// std::vector<int> v = {1, 2, 3, 4}; -// std::string s = absl::StrJoin(v, "-", MyFormatter()); -// EXPECT_EQ("1-2-3-4", s); +// The following is an example of a custom Formatter that uses +// `absl::FormatDuration` to join a list of `absl::Duration`s. +// +// std::vector<absl::Duration> v = {absl::Seconds(1), absl::Milliseconds(10)}; +// std::string s = +// absl::StrJoin(v, ", ", [](std::string* out, absl::Duration dur) { +// absl::StrAppend(out, absl::FormatDuration(dur)); +// }); +// EXPECT_EQ("1s, 10ms", s); // // The following standard formatters are provided within this file: // |