diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2019-06-17 22:18:33 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2019-06-17 22:18:33 +0000 |
commit | 3b1dabcfb41fd1df7dc4f936871ceb791ec1ba0c (patch) | |
tree | 87486ef173ac5d9d8e0dd680d0cd6082fb47d335 /lib/libcxx/include/string_view | |
parent | f4f65b7b02806e6b24a1fcbff610807714abca02 (diff) |
Import libc++ 8.0.0.
Diffstat (limited to 'lib/libcxx/include/string_view')
-rw-r--r-- | lib/libcxx/include/string_view | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/libcxx/include/string_view b/lib/libcxx/include/string_view index 6377aeb6d64..7d783122f12 100644 --- a/lib/libcxx/include/string_view +++ b/lib/libcxx/include/string_view @@ -178,6 +178,7 @@ namespace std { #include <iterator> #include <limits> #include <stdexcept> +#include <version> #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -768,6 +769,9 @@ bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type } typedef basic_string_view<char> string_view; +#ifndef _LIBCPP_NO_HAS_CHAR8_T +typedef basic_string_view<char8_t> u8string_view; +#endif typedef basic_string_view<char16_t> u16string_view; typedef basic_string_view<char32_t> u32string_view; typedef basic_string_view<wchar_t> wstring_view; @@ -777,17 +781,12 @@ template<class _CharT, class _Traits> struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, _Traits> > : public unary_function<basic_string_view<_CharT, _Traits>, size_t> { - size_t operator()(const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT { + return __do_string_hash(__val.data(), __val.data() + __val.size()); + } }; -template<class _CharT, class _Traits> -size_t -hash<basic_string_view<_CharT, _Traits> >::operator()( - const basic_string_view<_CharT, _Traits> __val) const _NOEXCEPT -{ - return __do_string_hash(__val.data(), __val.data() + __val.size()); -} - #if _LIBCPP_STD_VER > 11 inline namespace literals @@ -806,6 +805,14 @@ inline namespace literals return basic_string_view<wchar_t> (__str, __len); } +#ifndef _LIBCPP_NO_HAS_CHAR8_T + inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_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 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len) _NOEXCEPT { |