From d8933b836b1e1aac982b1dd42cc6ac1343a878d5 Mon Sep 17 00:00:00 2001 From: Lawrence Wolf-Sonkin Date: Fri, 10 Mar 2023 13:38:07 -0800 Subject: [absl] Update documentation to reflect hash support for std::wstring, std::u16string and std::u32stringstrings PiperOrigin-RevId: 515726337 Change-Id: I08e184ec1f7169835c034ac45a7e87293dc53078 --- absl/hash/hash.h | 7 ++++--- absl/hash/internal/hash.h | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'absl/hash') diff --git a/absl/hash/hash.h b/absl/hash/hash.h index 74e2d7c0..956befa9 100644 --- a/absl/hash/hash.h +++ b/absl/hash/hash.h @@ -110,9 +110,10 @@ ABSL_NAMESPACE_BEGIN // * std::unique_ptr and std::shared_ptr // * All string-like types including: // * absl::Cord -// * std::string -// * std::string_view (as well as any instance of std::basic_string that -// uses char and std::char_traits) +// * std::string (as well as any instance of std::basic_string that +// uses one of {char, wchar_t, char16_t, char32_t} and its associated +// std::char_traits) +// * std::string_view // * All the standard sequence containers (provided the elements are hashable) // * All the standard associative containers (provided the elements are // hashable) diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 61970e0d..a22a537b 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -516,14 +516,14 @@ H AbslHashValue(H hash_state, const std::shared_ptr& ptr) { // the same character sequence. These types are: // // - `absl::Cord` -// - `std::string` (and std::basic_string, A> for -// any allocator A) +// - `std::string` (and std::basic_string, A> for +// any allocator A and any T in {char, wchar_t, char16_t, char32_t}) // - `absl::string_view` and `std::string_view` // -// For simplicity, we currently support only `char` strings. This support may -// be broadened, if necessary, but with some caution - this overload would -// misbehave in cases where the traits' `eq()` member isn't equivalent to `==` -// on the underlying character type. +// For simplicity, we currently support only strings built on `char`, `wchar_t`, +// `char16_t`, or `char32_t`. This support may be broadened, if necessary, but +// with some caution - this overload would misbehave in cases where the traits' +// `eq()` member isn't equivalent to `==` on the underlying character type. template H AbslHashValue(H hash_state, absl::string_view str) { return H::combine( -- cgit v1.2.3