[libcxx-commits] [PATCH] D92325: Add std::hash<char8_t> specialization if char8_t is enabled
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 8 10:47:05 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb526d8761895: [libc++] Add std::hash<char8_t> specialization if char8_t is enabled (authored by georgthegreat, committed by ldionne).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92325/new/
https://reviews.llvm.org/D92325
Files:
libcxx/include/functional
libcxx/include/utility
Index: libcxx/include/utility
===================================================================
--- libcxx/include/utility
+++ libcxx/include/utility
@@ -1364,6 +1364,16 @@
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
+#ifndef _LIBCPP_NO_HAS_CHAR8_T
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
+ : public unary_function<char8_t, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+#endif // !_LIBCPP_NO_HAS_CHAR8_T
+
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>
Index: libcxx/include/functional
===================================================================
--- libcxx/include/functional
+++ libcxx/include/functional
@@ -470,6 +470,7 @@
template <> struct hash<char>;
template <> struct hash<signed char>;
template <> struct hash<unsigned char>;
+template <> struct hash<char8_t>; // since C++20
template <> struct hash<char16_t>;
template <> struct hash<char32_t>;
template <> struct hash<wchar_t>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92325.310284.patch
Type: text/x-patch
Size: 1073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201208/898b360a/attachment-0001.bin>
More information about the libcxx-commits
mailing list