1276792Sdim// -*- C++ -*- 2276792Sdim//===------------------------ string_view ---------------------------------===// 3276792Sdim// 4276792Sdim// The LLVM Compiler Infrastructure 5276792Sdim// 6276792Sdim// This file is distributed under the University of Illinois Open Source 7276792Sdim// License. See LICENSE.TXT for details. 8276792Sdim// 9276792Sdim//===----------------------------------------------------------------------===// 10276792Sdim 11276792Sdim#ifndef _LIBCPP_LFTS_STRING_VIEW 12276792Sdim#define _LIBCPP_LFTS_STRING_VIEW 13276792Sdim 14276792Sdim/* 15276792Sdimstring_view synopsis 16276792Sdim 17276792Sdimnamespace std { 18276792Sdim namespace experimental { 19276792Sdim inline namespace library_fundamentals_v1 { 20276792Sdim 21276792Sdim // 7.2, Class template basic_string_view 22276792Sdim template<class charT, class traits = char_traits<charT>> 23276792Sdim class basic_string_view; 24276792Sdim 25276792Sdim // 7.9, basic_string_view non-member comparison functions 26276792Sdim template<class charT, class traits> 27276792Sdim constexpr bool operator==(basic_string_view<charT, traits> x, 28276792Sdim basic_string_view<charT, traits> y) noexcept; 29276792Sdim template<class charT, class traits> 30276792Sdim constexpr bool operator!=(basic_string_view<charT, traits> x, 31276792Sdim basic_string_view<charT, traits> y) noexcept; 32276792Sdim template<class charT, class traits> 33276792Sdim constexpr bool operator< (basic_string_view<charT, traits> x, 34276792Sdim basic_string_view<charT, traits> y) noexcept; 35276792Sdim template<class charT, class traits> 36276792Sdim constexpr bool operator> (basic_string_view<charT, traits> x, 37276792Sdim basic_string_view<charT, traits> y) noexcept; 38276792Sdim template<class charT, class traits> 39276792Sdim constexpr bool operator<=(basic_string_view<charT, traits> x, 40276792Sdim basic_string_view<charT, traits> y) noexcept; 41276792Sdim template<class charT, class traits> 42276792Sdim constexpr bool operator>=(basic_string_view<charT, traits> x, 43276792Sdim basic_string_view<charT, traits> y) noexcept; 44276792Sdim // see below, sufficient additional overloads of comparison functions 45276792Sdim 46276792Sdim // 7.10, Inserters and extractors 47276792Sdim template<class charT, class traits> 48276792Sdim basic_ostream<charT, traits>& 49276792Sdim operator<<(basic_ostream<charT, traits>& os, 50276792Sdim basic_string_view<charT, traits> str); 51276792Sdim 52276792Sdim // basic_string_view typedef names 53276792Sdim typedef basic_string_view<char> string_view; 54276792Sdim typedef basic_string_view<char16_t> u16string_view; 55276792Sdim typedef basic_string_view<char32_t> u32string_view; 56276792Sdim typedef basic_string_view<wchar_t> wstring_view; 57276792Sdim 58276792Sdim template<class charT, class traits = char_traits<charT>> 59276792Sdim class basic_string_view { 60276792Sdim public: 61276792Sdim // types 62276792Sdim typedef traits traits_type; 63276792Sdim typedef charT value_type; 64276792Sdim typedef charT* pointer; 65276792Sdim typedef const charT* const_pointer; 66276792Sdim typedef charT& reference; 67276792Sdim typedef const charT& const_reference; 68276792Sdim typedef implementation-defined const_iterator; 69276792Sdim typedef const_iterator iterator; 70276792Sdim typedef reverse_iterator<const_iterator> const_reverse_iterator; 71276792Sdim typedef const_reverse_iterator reverse_iterator; 72276792Sdim typedef size_t size_type; 73276792Sdim typedef ptrdiff_t difference_type; 74276792Sdim static constexpr size_type npos = size_type(-1); 75276792Sdim 76276792Sdim // 7.3, basic_string_view constructors and assignment operators 77276792Sdim constexpr basic_string_view() noexcept; 78276792Sdim constexpr basic_string_view(const basic_string_view&) noexcept = default; 79276792Sdim basic_string_view& operator=(const basic_string_view&) noexcept = default; 80276792Sdim template<class Allocator> 81276792Sdim basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept; 82276792Sdim constexpr basic_string_view(const charT* str); 83276792Sdim constexpr basic_string_view(const charT* str, size_type len); 84276792Sdim 85276792Sdim // 7.4, basic_string_view iterator support 86276792Sdim constexpr const_iterator begin() const noexcept; 87276792Sdim constexpr const_iterator end() const noexcept; 88276792Sdim constexpr const_iterator cbegin() const noexcept; 89276792Sdim constexpr const_iterator cend() const noexcept; 90276792Sdim const_reverse_iterator rbegin() const noexcept; 91276792Sdim const_reverse_iterator rend() const noexcept; 92276792Sdim const_reverse_iterator crbegin() const noexcept; 93276792Sdim const_reverse_iterator crend() const noexcept; 94276792Sdim 95276792Sdim // 7.5, basic_string_view capacity 96276792Sdim constexpr size_type size() const noexcept; 97276792Sdim constexpr size_type length() const noexcept; 98276792Sdim constexpr size_type max_size() const noexcept; 99276792Sdim constexpr bool empty() const noexcept; 100276792Sdim 101276792Sdim // 7.6, basic_string_view element access 102276792Sdim constexpr const_reference operator[](size_type pos) const; 103276792Sdim constexpr const_reference at(size_type pos) const; 104276792Sdim constexpr const_reference front() const; 105276792Sdim constexpr const_reference back() const; 106276792Sdim constexpr const_pointer data() const noexcept; 107276792Sdim 108276792Sdim // 7.7, basic_string_view modifiers 109276792Sdim constexpr void clear() noexcept; 110276792Sdim constexpr void remove_prefix(size_type n); 111276792Sdim constexpr void remove_suffix(size_type n); 112276792Sdim constexpr void swap(basic_string_view& s) noexcept; 113276792Sdim 114276792Sdim // 7.8, basic_string_view string operations 115276792Sdim template<class Allocator> 116276792Sdim explicit operator basic_string<charT, traits, Allocator>() const; 117276792Sdim template<class Allocator = allocator<charT>> 118276792Sdim basic_string<charT, traits, Allocator> to_string( 119276792Sdim const Allocator& a = Allocator()) const; 120276792Sdim 121276792Sdim size_type copy(charT* s, size_type n, size_type pos = 0) const; 122276792Sdim 123276792Sdim constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const; 124276792Sdim constexpr int compare(basic_string_view s) const noexcept; 125276792Sdim constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const; 126276792Sdim constexpr int compare(size_type pos1, size_type n1, 127276792Sdim basic_string_view s, size_type pos2, size_type n2) const; 128276792Sdim constexpr int compare(const charT* s) const; 129276792Sdim constexpr int compare(size_type pos1, size_type n1, const charT* s) const; 130276792Sdim constexpr int compare(size_type pos1, size_type n1, 131276792Sdim const charT* s, size_type n2) const; 132276792Sdim constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept; 133276792Sdim constexpr size_type find(charT c, size_type pos = 0) const noexcept; 134276792Sdim constexpr size_type find(const charT* s, size_type pos, size_type n) const; 135276792Sdim constexpr size_type find(const charT* s, size_type pos = 0) const; 136276792Sdim constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept; 137276792Sdim constexpr size_type rfind(charT c, size_type pos = npos) const noexcept; 138276792Sdim constexpr size_type rfind(const charT* s, size_type pos, size_type n) const; 139276792Sdim constexpr size_type rfind(const charT* s, size_type pos = npos) const; 140276792Sdim constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept; 141276792Sdim constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept; 142276792Sdim constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const; 143276792Sdim constexpr size_type find_first_of(const charT* s, size_type pos = 0) const; 144276792Sdim constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept; 145276792Sdim constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept; 146276792Sdim constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const; 147276792Sdim constexpr size_type find_last_of(const charT* s, size_type pos = npos) const; 148276792Sdim constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept; 149276792Sdim constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept; 150276792Sdim constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const; 151276792Sdim constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const; 152276792Sdim constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept; 153276792Sdim constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept; 154276792Sdim constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const; 155276792Sdim constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const; 156276792Sdim 157276792Sdim private: 158276792Sdim const_pointer data_; // exposition only 159276792Sdim size_type size_; // exposition only 160276792Sdim }; 161276792Sdim 162276792Sdim } // namespace fundamentals_v1 163276792Sdim } // namespace experimental 164276792Sdim 165276792Sdim // 7.11, Hash support 166276792Sdim template <class T> struct hash; 167276792Sdim template <> struct hash<experimental::string_view>; 168276792Sdim template <> struct hash<experimental::u16string_view>; 169276792Sdim template <> struct hash<experimental::u32string_view>; 170276792Sdim template <> struct hash<experimental::wstring_view>; 171276792Sdim 172276792Sdim} // namespace std 173276792Sdim 174276792Sdim 175276792Sdim*/ 176276792Sdim 177276792Sdim#include <experimental/__config> 178276792Sdim 179276792Sdim#include <string> 180276792Sdim#include <algorithm> 181276792Sdim#include <iterator> 182276792Sdim#include <ostream> 183276792Sdim#include <iomanip> 184276792Sdim 185276792Sdim#include <__debug> 186276792Sdim 187276792Sdim#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 188276792Sdim#pragma GCC system_header 189276792Sdim#endif 190276792Sdim 191276792Sdim_LIBCPP_BEGIN_NAMESPACE_LFTS 192276792Sdim 193276792Sdim template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> > 194276792Sdim class _LIBCPP_TYPE_VIS_ONLY basic_string_view { 195276792Sdim public: 196276792Sdim // types 197276792Sdim typedef _Traits traits_type; 198276792Sdim typedef _CharT value_type; 199276792Sdim typedef const _CharT* pointer; 200276792Sdim typedef const _CharT* const_pointer; 201276792Sdim typedef const _CharT& reference; 202276792Sdim typedef const _CharT& const_reference; 203276792Sdim typedef const_pointer const_iterator; // See [string.view.iterators] 204276792Sdim typedef const_iterator iterator; 205276792Sdim typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; 206276792Sdim typedef const_reverse_iterator reverse_iterator; 207276792Sdim typedef size_t size_type; 208276792Sdim typedef ptrdiff_t difference_type; 209276792Sdim static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); 210276792Sdim 211276792Sdim // [string.view.cons], construct/copy 212276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 213276792Sdim basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} 214276792Sdim 215276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 216276792Sdim basic_string_view(const basic_string_view&) _NOEXCEPT = default; 217276792Sdim 218276792Sdim _LIBCPP_INLINE_VISIBILITY 219276792Sdim basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default; 220276792Sdim 221276792Sdim template<class _Allocator> 222276792Sdim _LIBCPP_INLINE_VISIBILITY 223276792Sdim basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT 224276792Sdim : __data (__str.data()), __size(__str.size()) {} 225276792Sdim 226276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 227276792Sdim basic_string_view(const _CharT* __s, size_type __len) 228276792Sdim : __data(__s), __size(__len) 229276792Sdim { 230276792Sdim// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr"); 231276792Sdim } 232276792Sdim 233276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 234276792Sdim basic_string_view(const _CharT* __s) 235276792Sdim : __data(__s), __size(_Traits::length(__s)) {} 236276792Sdim 237276792Sdim // [string.view.iterators], iterators 238276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 239276792Sdim const_iterator begin() const _NOEXCEPT { return cbegin(); } 240276792Sdim 241276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 242276792Sdim const_iterator end() const _NOEXCEPT { return cend(); } 243276792Sdim 244276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 245276792Sdim const_iterator cbegin() const _NOEXCEPT { return __data; } 246276792Sdim 247276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 248276792Sdim const_iterator cend() const _NOEXCEPT { return __data + __size; } 249276792Sdim 250276792Sdim _LIBCPP_INLINE_VISIBILITY 251276792Sdim const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } 252276792Sdim 253276792Sdim _LIBCPP_INLINE_VISIBILITY 254276792Sdim const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } 255276792Sdim 256276792Sdim _LIBCPP_INLINE_VISIBILITY 257276792Sdim const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } 258276792Sdim 259276792Sdim _LIBCPP_INLINE_VISIBILITY 260276792Sdim const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); } 261276792Sdim 262276792Sdim // [string.view.capacity], capacity 263276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 264276792Sdim size_type size() const _NOEXCEPT { return __size; } 265276792Sdim 266276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 267276792Sdim size_type length() const _NOEXCEPT { return __size; } 268276792Sdim 269276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 270276792Sdim size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); } 271276792Sdim 272276792Sdim _LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY 273276792Sdim empty() const _NOEXCEPT { return __size == 0; } 274276792Sdim 275276792Sdim // [string.view.access], element access 276276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 277276792Sdim const_reference operator[](size_type __pos) const { return __data[__pos]; } 278276792Sdim 279276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 280276792Sdim const_reference at(size_type __pos) const 281276792Sdim { 282276792Sdim return __pos >= size() 283288943Sdim ? (throw out_of_range("string_view::at"), __data[0]) 284276792Sdim : __data[__pos]; 285276792Sdim } 286276792Sdim 287276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 288276792Sdim const_reference front() const 289276792Sdim { 290276792Sdim return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0]; 291276792Sdim } 292276792Sdim 293276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 294276792Sdim const_reference back() const 295276792Sdim { 296276792Sdim return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1]; 297276792Sdim } 298276792Sdim 299276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 300276792Sdim const_pointer data() const _NOEXCEPT { return __data; } 301276792Sdim 302276792Sdim // [string.view.modifiers], modifiers: 303276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 304276792Sdim void clear() _NOEXCEPT 305276792Sdim { 306276792Sdim __data = nullptr; 307276792Sdim __size = 0; 308276792Sdim } 309276792Sdim 310276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 311276792Sdim void remove_prefix(size_type __n) _NOEXCEPT 312276792Sdim { 313288943Sdim _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); 314276792Sdim __data += __n; 315276792Sdim __size -= __n; 316276792Sdim } 317276792Sdim 318276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 319276792Sdim void remove_suffix(size_type __n) _NOEXCEPT 320276792Sdim { 321288943Sdim _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); 322276792Sdim __size -= __n; 323276792Sdim } 324276792Sdim 325276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 326276792Sdim void swap(basic_string_view& __other) _NOEXCEPT 327276792Sdim { 328276792Sdim const value_type *__p = __data; 329276792Sdim __data = __other.__data; 330276792Sdim __other.__data = __p; 331276792Sdim 332276792Sdim size_type __sz = __size; 333276792Sdim __size = __other.__size; 334276792Sdim __other.__size = __sz; 335276792Sdim// _VSTD::swap( __data, __other.__data ); 336276792Sdim// _VSTD::swap( __size, __other.__size ); 337276792Sdim } 338276792Sdim 339276792Sdim // [string.view.ops], string operations: 340276792Sdim template<class _Allocator> 341276792Sdim _LIBCPP_INLINE_VISIBILITY 342276792Sdim _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const 343276792Sdim { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); } 344276792Sdim 345276792Sdim template<class _Allocator = allocator<_CharT> > 346276792Sdim _LIBCPP_INLINE_VISIBILITY 347276792Sdim basic_string<_CharT, _Traits, _Allocator> 348276792Sdim to_string( const _Allocator& __a = _Allocator()) const 349276792Sdim { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); } 350276792Sdim 351276792Sdim size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const 352276792Sdim { 353276792Sdim if ( __pos > size()) 354276792Sdim throw out_of_range("string_view::copy"); 355276792Sdim size_type __rlen = _VSTD::min( __n, size() - __pos ); 356276792Sdim _VSTD::copy_n(begin() + __pos, __rlen, __s ); 357276792Sdim return __rlen; 358276792Sdim } 359276792Sdim 360276792Sdim _LIBCPP_CONSTEXPR 361276792Sdim basic_string_view substr(size_type __pos = 0, size_type __n = npos) const 362276792Sdim { 363276792Sdim// if (__pos > size()) 364276792Sdim// throw out_of_range("string_view::substr"); 365276792Sdim// size_type __rlen = _VSTD::min( __n, size() - __pos ); 366276792Sdim// return basic_string_view(data() + __pos, __rlen); 367276792Sdim return __pos > size() 368276792Sdim ? throw out_of_range("string_view::substr") 369276792Sdim : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos)); 370276792Sdim } 371276792Sdim 372276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT 373276792Sdim { 374276792Sdim size_type __rlen = _VSTD::min( size(), __sv.size()); 375276792Sdim int __retval = _Traits::compare(data(), __sv.data(), __rlen); 376276792Sdim if ( __retval == 0 ) // first __rlen chars matched 377276792Sdim __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); 378276792Sdim return __retval; 379276792Sdim } 380276792Sdim 381276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 382276792Sdim int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const 383276792Sdim { 384276792Sdim return substr(__pos1, __n1).compare(__sv); 385276792Sdim } 386276792Sdim 387276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 388276792Sdim int compare( size_type __pos1, size_type __n1, 389276792Sdim basic_string_view _sv, size_type __pos2, size_type __n2) const 390276792Sdim { 391276792Sdim return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); 392276792Sdim } 393276792Sdim 394276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 395276792Sdim int compare(const _CharT* __s) const 396276792Sdim { 397276792Sdim return compare(basic_string_view(__s)); 398276792Sdim } 399276792Sdim 400276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 401276792Sdim int compare(size_type __pos1, size_type __n1, const _CharT* __s) const 402276792Sdim { 403276792Sdim return substr(__pos1, __n1).compare(basic_string_view(__s)); 404276792Sdim } 405276792Sdim 406276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 407276792Sdim int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const 408276792Sdim { 409276792Sdim return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); 410276792Sdim } 411276792Sdim 412276792Sdim // find 413276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 414276792Sdim size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT 415276792Sdim { 416276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); 417276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 418276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 419276792Sdim } 420276792Sdim 421276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 422276792Sdim size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT 423276792Sdim { 424276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 425276792Sdim (data(), size(), __c, __pos); 426276792Sdim } 427276792Sdim 428276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 429276792Sdim size_type find(const _CharT* __s, size_type __pos, size_type __n) const 430276792Sdim { 431276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr"); 432276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 433276792Sdim (data(), size(), __s, __pos, __n); 434276792Sdim } 435276792Sdim 436276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 437276792Sdim size_type find(const _CharT* __s, size_type __pos = 0) const 438276792Sdim { 439276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr"); 440276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 441276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 442276792Sdim } 443276792Sdim 444276792Sdim // rfind 445276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 446276792Sdim size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT 447276792Sdim { 448276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); 449276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 450276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 451276792Sdim } 452276792Sdim 453276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 454276792Sdim size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT 455276792Sdim { 456276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 457276792Sdim (data(), size(), __c, __pos); 458276792Sdim } 459276792Sdim 460276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 461276792Sdim size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const 462276792Sdim { 463276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr"); 464276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 465276792Sdim (data(), size(), __s, __pos, __n); 466276792Sdim } 467276792Sdim 468276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 469276792Sdim size_type rfind(const _CharT* __s, size_type __pos=npos) const 470276792Sdim { 471276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr"); 472276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 473276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 474276792Sdim } 475276792Sdim 476276792Sdim // find_first_of 477276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 478276792Sdim size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT 479276792Sdim { 480276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr"); 481276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 482276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 483276792Sdim } 484276792Sdim 485276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 486276792Sdim size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT 487276792Sdim { return find(__c, __pos); } 488276792Sdim 489276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 490276792Sdim size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const 491276792Sdim { 492276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr"); 493276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 494276792Sdim (data(), size(), __s, __pos, __n); 495276792Sdim } 496276792Sdim 497276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 498276792Sdim size_type find_first_of(const _CharT* __s, size_type __pos=0) const 499276792Sdim { 500276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr"); 501276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 502276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 503276792Sdim } 504276792Sdim 505276792Sdim // find_last_of 506276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 507276792Sdim size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT 508276792Sdim { 509276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr"); 510276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 511276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 512276792Sdim } 513276792Sdim 514276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 515276792Sdim size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT 516276792Sdim { return rfind(__c, __pos); } 517276792Sdim 518276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 519276792Sdim size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const 520276792Sdim { 521276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr"); 522276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 523276792Sdim (data(), size(), __s, __pos, __n); 524276792Sdim } 525276792Sdim 526276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 527276792Sdim size_type find_last_of(const _CharT* __s, size_type __pos=npos) const 528276792Sdim { 529276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr"); 530276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 531276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 532276792Sdim } 533276792Sdim 534276792Sdim // find_first_not_of 535276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 536276792Sdim size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT 537276792Sdim { 538276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 539276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 540276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 541276792Sdim } 542276792Sdim 543276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 544276792Sdim size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT 545276792Sdim { 546276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 547276792Sdim (data(), size(), __c, __pos); 548276792Sdim } 549276792Sdim 550276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 551276792Sdim size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const 552276792Sdim { 553276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 554276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 555276792Sdim (data(), size(), __s, __pos, __n); 556276792Sdim } 557276792Sdim 558276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 559276792Sdim size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const 560276792Sdim { 561276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 562276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 563276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 564276792Sdim } 565276792Sdim 566276792Sdim // find_last_not_of 567276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 568276792Sdim size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT 569276792Sdim { 570276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 571276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 572276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 573276792Sdim } 574276792Sdim 575276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 576276792Sdim size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT 577276792Sdim { 578276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 579276792Sdim (data(), size(), __c, __pos); 580276792Sdim } 581276792Sdim 582276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 583276792Sdim size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const 584276792Sdim { 585276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 586276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 587276792Sdim (data(), size(), __s, __pos, __n); 588276792Sdim } 589276792Sdim 590276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 591276792Sdim size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const 592276792Sdim { 593276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 594276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 595276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 596276792Sdim } 597276792Sdim 598276792Sdim private: 599276792Sdim const value_type* __data; 600276792Sdim size_type __size; 601276792Sdim }; 602276792Sdim 603276792Sdim 604276792Sdim // [string.view.comparison] 605276792Sdim // operator == 606276792Sdim template<class _CharT, class _Traits> 607276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 608276792Sdim bool operator==(basic_string_view<_CharT, _Traits> __lhs, 609276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 610276792Sdim { 611276792Sdim if ( __lhs.size() != __rhs.size()) return false; 612276792Sdim return __lhs.compare(__rhs) == 0; 613276792Sdim } 614276792Sdim 615276792Sdim template<class _CharT, class _Traits> 616276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 617276792Sdim bool operator==(basic_string_view<_CharT, _Traits> __lhs, 618276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 619276792Sdim { 620276792Sdim if ( __lhs.size() != __rhs.size()) return false; 621276792Sdim return __lhs.compare(__rhs) == 0; 622276792Sdim } 623276792Sdim 624276792Sdim template<class _CharT, class _Traits> 625276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 626276792Sdim bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 627276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 628276792Sdim { 629276792Sdim if ( __lhs.size() != __rhs.size()) return false; 630276792Sdim return __lhs.compare(__rhs) == 0; 631276792Sdim } 632276792Sdim 633276792Sdim 634276792Sdim // operator != 635276792Sdim template<class _CharT, class _Traits> 636276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 637276792Sdim bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 638276792Sdim { 639276792Sdim if ( __lhs.size() != __rhs.size()) 640276792Sdim return true; 641276792Sdim return __lhs.compare(__rhs) != 0; 642276792Sdim } 643276792Sdim 644276792Sdim template<class _CharT, class _Traits> 645276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 646276792Sdim bool operator!=(basic_string_view<_CharT, _Traits> __lhs, 647276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 648276792Sdim { 649276792Sdim if ( __lhs.size() != __rhs.size()) 650276792Sdim return true; 651276792Sdim return __lhs.compare(__rhs) != 0; 652276792Sdim } 653276792Sdim 654276792Sdim template<class _CharT, class _Traits> 655276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 656276792Sdim bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 657276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 658276792Sdim { 659276792Sdim if ( __lhs.size() != __rhs.size()) 660276792Sdim return true; 661276792Sdim return __lhs.compare(__rhs) != 0; 662276792Sdim } 663276792Sdim 664276792Sdim 665276792Sdim // operator < 666276792Sdim template<class _CharT, class _Traits> 667276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 668276792Sdim bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 669276792Sdim { 670276792Sdim return __lhs.compare(__rhs) < 0; 671276792Sdim } 672276792Sdim 673276792Sdim template<class _CharT, class _Traits> 674276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 675276792Sdim bool operator<(basic_string_view<_CharT, _Traits> __lhs, 676276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 677276792Sdim { 678276792Sdim return __lhs.compare(__rhs) < 0; 679276792Sdim } 680276792Sdim 681276792Sdim template<class _CharT, class _Traits> 682276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 683276792Sdim bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 684276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 685276792Sdim { 686276792Sdim return __lhs.compare(__rhs) < 0; 687276792Sdim } 688276792Sdim 689276792Sdim 690276792Sdim // operator > 691276792Sdim template<class _CharT, class _Traits> 692276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 693276792Sdim bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 694276792Sdim { 695276792Sdim return __lhs.compare(__rhs) > 0; 696276792Sdim } 697276792Sdim 698276792Sdim template<class _CharT, class _Traits> 699276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 700276792Sdim bool operator>(basic_string_view<_CharT, _Traits> __lhs, 701276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 702276792Sdim { 703276792Sdim return __lhs.compare(__rhs) > 0; 704276792Sdim } 705276792Sdim 706276792Sdim template<class _CharT, class _Traits> 707276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 708276792Sdim bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 709276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 710276792Sdim { 711276792Sdim return __lhs.compare(__rhs) > 0; 712276792Sdim } 713276792Sdim 714276792Sdim 715276792Sdim // operator <= 716276792Sdim template<class _CharT, class _Traits> 717276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 718276792Sdim bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 719276792Sdim { 720276792Sdim return __lhs.compare(__rhs) <= 0; 721276792Sdim } 722276792Sdim 723276792Sdim template<class _CharT, class _Traits> 724276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 725276792Sdim bool operator<=(basic_string_view<_CharT, _Traits> __lhs, 726276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 727276792Sdim { 728276792Sdim return __lhs.compare(__rhs) <= 0; 729276792Sdim } 730276792Sdim 731276792Sdim template<class _CharT, class _Traits> 732276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 733276792Sdim bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 734276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 735276792Sdim { 736276792Sdim return __lhs.compare(__rhs) <= 0; 737276792Sdim } 738276792Sdim 739276792Sdim 740276792Sdim // operator >= 741276792Sdim template<class _CharT, class _Traits> 742276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 743276792Sdim bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 744276792Sdim { 745276792Sdim return __lhs.compare(__rhs) >= 0; 746276792Sdim } 747276792Sdim 748276792Sdim 749276792Sdim template<class _CharT, class _Traits> 750276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 751276792Sdim bool operator>=(basic_string_view<_CharT, _Traits> __lhs, 752276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 753276792Sdim { 754276792Sdim return __lhs.compare(__rhs) >= 0; 755276792Sdim } 756276792Sdim 757276792Sdim template<class _CharT, class _Traits> 758276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 759276792Sdim bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 760276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 761276792Sdim { 762276792Sdim return __lhs.compare(__rhs) >= 0; 763276792Sdim } 764276792Sdim 765276792Sdim 766276792Sdim // [string.view.io] 767276792Sdim template<class _CharT, class _Traits> 768276792Sdim basic_ostream<_CharT, _Traits>& 769276792Sdim operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) 770276792Sdim { 771276792Sdim return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); 772276792Sdim } 773276792Sdim 774276792Sdim typedef basic_string_view<char> string_view; 775276792Sdim typedef basic_string_view<char16_t> u16string_view; 776276792Sdim typedef basic_string_view<char32_t> u32string_view; 777276792Sdim typedef basic_string_view<wchar_t> wstring_view; 778276792Sdim 779276792Sdim_LIBCPP_END_NAMESPACE_LFTS 780276792Sdim_LIBCPP_BEGIN_NAMESPACE_STD 781276792Sdim 782276792Sdim// [string.view.hash] 783276792Sdim// Shamelessly stolen from <string> 784276792Sdimtemplate<class _CharT, class _Traits> 785276792Sdimstruct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> > 786276792Sdim : public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t> 787276792Sdim{ 788276792Sdim size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT; 789276792Sdim}; 790276792Sdim 791276792Sdimtemplate<class _CharT, class _Traits> 792276792Sdimsize_t 793276792Sdimhash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()( 794276792Sdim const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT 795276792Sdim{ 796276792Sdim return __do_string_hash(__val.data(), __val.data() + __val.size()); 797276792Sdim} 798276792Sdim 799276792Sdim#if _LIBCPP_STD_VER > 11 800276792Sdimtemplate <class _CharT, class _Traits> 801276792Sdim__quoted_output_proxy<_CharT, const _CharT *, _Traits> 802276792Sdimquoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, 803276792Sdim _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) 804276792Sdim{ 805276792Sdim return __quoted_output_proxy<_CharT, const _CharT *, _Traits> 806276792Sdim ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); 807276792Sdim} 808276792Sdim#endif 809276792Sdim 810276792Sdim_LIBCPP_END_NAMESPACE_STD 811276792Sdim 812276792Sdim#endif // _LIBCPP_LFTS_STRING_VIEW 813