summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental/string_view
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/experimental/string_view')
-rw-r--r--libstdc++-v3/include/experimental/string_view24
1 files changed, 24 insertions, 0 deletions
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 8cc0e90246b..ce2c14cfe36 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -566,6 +566,9 @@ inline namespace fundamentals_v1
#ifdef _GLIBCXX_USE_WCHAR_T
using wstring_view = basic_string_view<wchar_t>;
#endif
+#ifdef _GLIBCXX_USE_CHAR8_T
+ using u8string_view = basic_string_view<char8_t>;
+#endif
using u16string_view = basic_string_view<char16_t>;
using u32string_view = basic_string_view<char32_t>;
} // namespace fundamentals_v1
@@ -605,6 +608,21 @@ inline namespace fundamentals_v1
{ };
#endif
+#ifdef _GLIBCXX_USE_CHAR8_T
+ template<>
+ struct hash<experimental::u8string_view>
+ : public __hash_base<size_t, experimental::u8string_view>
+ {
+ size_t
+ operator()(const experimental::u8string_view& __s) const noexcept
+ { return std::_Hash_impl::hash(__s.data(), __s.length()); }
+ };
+
+ template<>
+ struct __is_fast_hash<hash<experimental::u8string_view>> : std::false_type
+ { };
+#endif
+
template<>
struct hash<experimental::u16string_view>
: public __hash_base<size_t, experimental::u16string_view>
@@ -652,6 +670,12 @@ namespace experimental
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
+#ifdef _GLIBCXX_USE_CHAR8_T
+ inline constexpr basic_string_view<char8_t>
+ operator""sv(const char8_t* __str, size_t __len) noexcept
+ { return basic_string_view<char8_t>{__str, __len}; }
+#endif
+
inline constexpr basic_string_view<char16_t>
operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }