string_view revision 276792
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() 283276792Sdim ? throw out_of_range("string_view::at") 284276792Sdim : __data[__pos]; 285276792Sdim// if (__pos >= size()) 286276792Sdim// throw out_of_range("string_view::at"); 287276792Sdim// return __data[__pos]; 288276792Sdim } 289276792Sdim 290276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 291276792Sdim const_reference front() const 292276792Sdim { 293276792Sdim return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0]; 294276792Sdim } 295276792Sdim 296276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 297276792Sdim const_reference back() const 298276792Sdim { 299276792Sdim return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1]; 300276792Sdim } 301276792Sdim 302276792Sdim _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY 303276792Sdim const_pointer data() const _NOEXCEPT { return __data; } 304276792Sdim 305276792Sdim // [string.view.modifiers], modifiers: 306276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 307276792Sdim void clear() _NOEXCEPT 308276792Sdim { 309276792Sdim __data = nullptr; 310276792Sdim __size = 0; 311276792Sdim } 312276792Sdim 313276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 314276792Sdim void remove_prefix(size_type __n) _NOEXCEPT 315276792Sdim { 316276792Sdim _LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()"); 317276792Sdim __data += __n; 318276792Sdim __size -= __n; 319276792Sdim } 320276792Sdim 321276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 322276792Sdim void remove_suffix(size_type __n) _NOEXCEPT 323276792Sdim { 324276792Sdim _LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()"); 325276792Sdim __size -= __n; 326276792Sdim } 327276792Sdim 328276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 329276792Sdim void swap(basic_string_view& __other) _NOEXCEPT 330276792Sdim { 331276792Sdim const value_type *__p = __data; 332276792Sdim __data = __other.__data; 333276792Sdim __other.__data = __p; 334276792Sdim 335276792Sdim size_type __sz = __size; 336276792Sdim __size = __other.__size; 337276792Sdim __other.__size = __sz; 338276792Sdim// _VSTD::swap( __data, __other.__data ); 339276792Sdim// _VSTD::swap( __size, __other.__size ); 340276792Sdim } 341276792Sdim 342276792Sdim // [string.view.ops], string operations: 343276792Sdim template<class _Allocator> 344276792Sdim _LIBCPP_INLINE_VISIBILITY 345276792Sdim _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const 346276792Sdim { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); } 347276792Sdim 348276792Sdim template<class _Allocator = allocator<_CharT> > 349276792Sdim _LIBCPP_INLINE_VISIBILITY 350276792Sdim basic_string<_CharT, _Traits, _Allocator> 351276792Sdim to_string( const _Allocator& __a = _Allocator()) const 352276792Sdim { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); } 353276792Sdim 354276792Sdim size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const 355276792Sdim { 356276792Sdim if ( __pos > size()) 357276792Sdim throw out_of_range("string_view::copy"); 358276792Sdim size_type __rlen = _VSTD::min( __n, size() - __pos ); 359276792Sdim _VSTD::copy_n(begin() + __pos, __rlen, __s ); 360276792Sdim return __rlen; 361276792Sdim } 362276792Sdim 363276792Sdim _LIBCPP_CONSTEXPR 364276792Sdim basic_string_view substr(size_type __pos = 0, size_type __n = npos) const 365276792Sdim { 366276792Sdim// if (__pos > size()) 367276792Sdim// throw out_of_range("string_view::substr"); 368276792Sdim// size_type __rlen = _VSTD::min( __n, size() - __pos ); 369276792Sdim// return basic_string_view(data() + __pos, __rlen); 370276792Sdim return __pos > size() 371276792Sdim ? throw out_of_range("string_view::substr") 372276792Sdim : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos)); 373276792Sdim } 374276792Sdim 375276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT 376276792Sdim { 377276792Sdim size_type __rlen = _VSTD::min( size(), __sv.size()); 378276792Sdim int __retval = _Traits::compare(data(), __sv.data(), __rlen); 379276792Sdim if ( __retval == 0 ) // first __rlen chars matched 380276792Sdim __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); 381276792Sdim return __retval; 382276792Sdim } 383276792Sdim 384276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 385276792Sdim int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const 386276792Sdim { 387276792Sdim return substr(__pos1, __n1).compare(__sv); 388276792Sdim } 389276792Sdim 390276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 391276792Sdim int compare( size_type __pos1, size_type __n1, 392276792Sdim basic_string_view _sv, size_type __pos2, size_type __n2) const 393276792Sdim { 394276792Sdim return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); 395276792Sdim } 396276792Sdim 397276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 398276792Sdim int compare(const _CharT* __s) const 399276792Sdim { 400276792Sdim return compare(basic_string_view(__s)); 401276792Sdim } 402276792Sdim 403276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 404276792Sdim int compare(size_type __pos1, size_type __n1, const _CharT* __s) const 405276792Sdim { 406276792Sdim return substr(__pos1, __n1).compare(basic_string_view(__s)); 407276792Sdim } 408276792Sdim 409276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 410276792Sdim int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const 411276792Sdim { 412276792Sdim return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); 413276792Sdim } 414276792Sdim 415276792Sdim // find 416276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 417276792Sdim size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT 418276792Sdim { 419276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); 420276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 421276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 422276792Sdim } 423276792Sdim 424276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 425276792Sdim size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT 426276792Sdim { 427276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 428276792Sdim (data(), size(), __c, __pos); 429276792Sdim } 430276792Sdim 431276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 432276792Sdim size_type find(const _CharT* __s, size_type __pos, size_type __n) const 433276792Sdim { 434276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr"); 435276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 436276792Sdim (data(), size(), __s, __pos, __n); 437276792Sdim } 438276792Sdim 439276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 440276792Sdim size_type find(const _CharT* __s, size_type __pos = 0) const 441276792Sdim { 442276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr"); 443276792Sdim return _VSTD::__str_find<value_type, size_type, traits_type, npos> 444276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 445276792Sdim } 446276792Sdim 447276792Sdim // rfind 448276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 449276792Sdim size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT 450276792Sdim { 451276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr"); 452276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 453276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 454276792Sdim } 455276792Sdim 456276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 457276792Sdim size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT 458276792Sdim { 459276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 460276792Sdim (data(), size(), __c, __pos); 461276792Sdim } 462276792Sdim 463276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 464276792Sdim size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const 465276792Sdim { 466276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr"); 467276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 468276792Sdim (data(), size(), __s, __pos, __n); 469276792Sdim } 470276792Sdim 471276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 472276792Sdim size_type rfind(const _CharT* __s, size_type __pos=npos) const 473276792Sdim { 474276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr"); 475276792Sdim return _VSTD::__str_rfind<value_type, size_type, traits_type, npos> 476276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 477276792Sdim } 478276792Sdim 479276792Sdim // find_first_of 480276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 481276792Sdim size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT 482276792Sdim { 483276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr"); 484276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 485276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 486276792Sdim } 487276792Sdim 488276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 489276792Sdim size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT 490276792Sdim { return find(__c, __pos); } 491276792Sdim 492276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 493276792Sdim size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const 494276792Sdim { 495276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr"); 496276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 497276792Sdim (data(), size(), __s, __pos, __n); 498276792Sdim } 499276792Sdim 500276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 501276792Sdim size_type find_first_of(const _CharT* __s, size_type __pos=0) const 502276792Sdim { 503276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr"); 504276792Sdim return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos> 505276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 506276792Sdim } 507276792Sdim 508276792Sdim // find_last_of 509276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 510276792Sdim size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT 511276792Sdim { 512276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr"); 513276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 514276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 515276792Sdim } 516276792Sdim 517276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 518276792Sdim size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT 519276792Sdim { return rfind(__c, __pos); } 520276792Sdim 521276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 522276792Sdim size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const 523276792Sdim { 524276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr"); 525276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 526276792Sdim (data(), size(), __s, __pos, __n); 527276792Sdim } 528276792Sdim 529276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 530276792Sdim size_type find_last_of(const _CharT* __s, size_type __pos=npos) const 531276792Sdim { 532276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr"); 533276792Sdim return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos> 534276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 535276792Sdim } 536276792Sdim 537276792Sdim // find_first_not_of 538276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 539276792Sdim size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT 540276792Sdim { 541276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 542276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 543276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 544276792Sdim } 545276792Sdim 546276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 547276792Sdim size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT 548276792Sdim { 549276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 550276792Sdim (data(), size(), __c, __pos); 551276792Sdim } 552276792Sdim 553276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 554276792Sdim size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const 555276792Sdim { 556276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 557276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 558276792Sdim (data(), size(), __s, __pos, __n); 559276792Sdim } 560276792Sdim 561276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 562276792Sdim size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const 563276792Sdim { 564276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr"); 565276792Sdim return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos> 566276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 567276792Sdim } 568276792Sdim 569276792Sdim // find_last_not_of 570276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 571276792Sdim size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT 572276792Sdim { 573276792Sdim _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 574276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 575276792Sdim (data(), size(), __s.data(), __pos, __s.size()); 576276792Sdim } 577276792Sdim 578276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 579276792Sdim size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT 580276792Sdim { 581276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 582276792Sdim (data(), size(), __c, __pos); 583276792Sdim } 584276792Sdim 585276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 586276792Sdim size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const 587276792Sdim { 588276792Sdim _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 589276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 590276792Sdim (data(), size(), __s, __pos, __n); 591276792Sdim } 592276792Sdim 593276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 594276792Sdim size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const 595276792Sdim { 596276792Sdim _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr"); 597276792Sdim return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos> 598276792Sdim (data(), size(), __s, __pos, traits_type::length(__s)); 599276792Sdim } 600276792Sdim 601276792Sdim private: 602276792Sdim const value_type* __data; 603276792Sdim size_type __size; 604276792Sdim }; 605276792Sdim 606276792Sdim 607276792Sdim // [string.view.comparison] 608276792Sdim // operator == 609276792Sdim template<class _CharT, class _Traits> 610276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 611276792Sdim bool operator==(basic_string_view<_CharT, _Traits> __lhs, 612276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 613276792Sdim { 614276792Sdim if ( __lhs.size() != __rhs.size()) return false; 615276792Sdim return __lhs.compare(__rhs) == 0; 616276792Sdim } 617276792Sdim 618276792Sdim template<class _CharT, class _Traits> 619276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 620276792Sdim bool operator==(basic_string_view<_CharT, _Traits> __lhs, 621276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 622276792Sdim { 623276792Sdim if ( __lhs.size() != __rhs.size()) return false; 624276792Sdim return __lhs.compare(__rhs) == 0; 625276792Sdim } 626276792Sdim 627276792Sdim template<class _CharT, class _Traits> 628276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 629276792Sdim bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 630276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 631276792Sdim { 632276792Sdim if ( __lhs.size() != __rhs.size()) return false; 633276792Sdim return __lhs.compare(__rhs) == 0; 634276792Sdim } 635276792Sdim 636276792Sdim 637276792Sdim // operator != 638276792Sdim template<class _CharT, class _Traits> 639276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 640276792Sdim bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 641276792Sdim { 642276792Sdim if ( __lhs.size() != __rhs.size()) 643276792Sdim return true; 644276792Sdim return __lhs.compare(__rhs) != 0; 645276792Sdim } 646276792Sdim 647276792Sdim template<class _CharT, class _Traits> 648276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 649276792Sdim bool operator!=(basic_string_view<_CharT, _Traits> __lhs, 650276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 651276792Sdim { 652276792Sdim if ( __lhs.size() != __rhs.size()) 653276792Sdim return true; 654276792Sdim return __lhs.compare(__rhs) != 0; 655276792Sdim } 656276792Sdim 657276792Sdim template<class _CharT, class _Traits> 658276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 659276792Sdim bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 660276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 661276792Sdim { 662276792Sdim if ( __lhs.size() != __rhs.size()) 663276792Sdim return true; 664276792Sdim return __lhs.compare(__rhs) != 0; 665276792Sdim } 666276792Sdim 667276792Sdim 668276792Sdim // operator < 669276792Sdim template<class _CharT, class _Traits> 670276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 671276792Sdim bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 672276792Sdim { 673276792Sdim return __lhs.compare(__rhs) < 0; 674276792Sdim } 675276792Sdim 676276792Sdim template<class _CharT, class _Traits> 677276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 678276792Sdim bool operator<(basic_string_view<_CharT, _Traits> __lhs, 679276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 680276792Sdim { 681276792Sdim return __lhs.compare(__rhs) < 0; 682276792Sdim } 683276792Sdim 684276792Sdim template<class _CharT, class _Traits> 685276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 686276792Sdim bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 687276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 688276792Sdim { 689276792Sdim return __lhs.compare(__rhs) < 0; 690276792Sdim } 691276792Sdim 692276792Sdim 693276792Sdim // operator > 694276792Sdim template<class _CharT, class _Traits> 695276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 696276792Sdim bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 697276792Sdim { 698276792Sdim return __lhs.compare(__rhs) > 0; 699276792Sdim } 700276792Sdim 701276792Sdim template<class _CharT, class _Traits> 702276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 703276792Sdim bool operator>(basic_string_view<_CharT, _Traits> __lhs, 704276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 705276792Sdim { 706276792Sdim return __lhs.compare(__rhs) > 0; 707276792Sdim } 708276792Sdim 709276792Sdim template<class _CharT, class _Traits> 710276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 711276792Sdim bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 712276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 713276792Sdim { 714276792Sdim return __lhs.compare(__rhs) > 0; 715276792Sdim } 716276792Sdim 717276792Sdim 718276792Sdim // operator <= 719276792Sdim template<class _CharT, class _Traits> 720276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 721276792Sdim bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 722276792Sdim { 723276792Sdim return __lhs.compare(__rhs) <= 0; 724276792Sdim } 725276792Sdim 726276792Sdim template<class _CharT, class _Traits> 727276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 728276792Sdim bool operator<=(basic_string_view<_CharT, _Traits> __lhs, 729276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 730276792Sdim { 731276792Sdim return __lhs.compare(__rhs) <= 0; 732276792Sdim } 733276792Sdim 734276792Sdim template<class _CharT, class _Traits> 735276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 736276792Sdim bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 737276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 738276792Sdim { 739276792Sdim return __lhs.compare(__rhs) <= 0; 740276792Sdim } 741276792Sdim 742276792Sdim 743276792Sdim // operator >= 744276792Sdim template<class _CharT, class _Traits> 745276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 746276792Sdim bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 747276792Sdim { 748276792Sdim return __lhs.compare(__rhs) >= 0; 749276792Sdim } 750276792Sdim 751276792Sdim 752276792Sdim template<class _CharT, class _Traits> 753276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 754276792Sdim bool operator>=(basic_string_view<_CharT, _Traits> __lhs, 755276792Sdim typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT 756276792Sdim { 757276792Sdim return __lhs.compare(__rhs) >= 0; 758276792Sdim } 759276792Sdim 760276792Sdim template<class _CharT, class _Traits> 761276792Sdim _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 762276792Sdim bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs, 763276792Sdim basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT 764276792Sdim { 765276792Sdim return __lhs.compare(__rhs) >= 0; 766276792Sdim } 767276792Sdim 768276792Sdim 769276792Sdim // [string.view.io] 770276792Sdim template<class _CharT, class _Traits> 771276792Sdim basic_ostream<_CharT, _Traits>& 772276792Sdim operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) 773276792Sdim { 774276792Sdim return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); 775276792Sdim } 776276792Sdim 777276792Sdim typedef basic_string_view<char> string_view; 778276792Sdim typedef basic_string_view<char16_t> u16string_view; 779276792Sdim typedef basic_string_view<char32_t> u32string_view; 780276792Sdim typedef basic_string_view<wchar_t> wstring_view; 781276792Sdim 782276792Sdim_LIBCPP_END_NAMESPACE_LFTS 783276792Sdim_LIBCPP_BEGIN_NAMESPACE_STD 784276792Sdim 785276792Sdim// [string.view.hash] 786276792Sdim// Shamelessly stolen from <string> 787276792Sdimtemplate<class _CharT, class _Traits> 788276792Sdimstruct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> > 789276792Sdim : public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t> 790276792Sdim{ 791276792Sdim size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT; 792276792Sdim}; 793276792Sdim 794276792Sdimtemplate<class _CharT, class _Traits> 795276792Sdimsize_t 796276792Sdimhash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()( 797276792Sdim const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT 798276792Sdim{ 799276792Sdim return __do_string_hash(__val.data(), __val.data() + __val.size()); 800276792Sdim} 801276792Sdim 802276792Sdim#if _LIBCPP_STD_VER > 11 803276792Sdimtemplate <class _CharT, class _Traits> 804276792Sdim__quoted_output_proxy<_CharT, const _CharT *, _Traits> 805276792Sdimquoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, 806276792Sdim _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) 807276792Sdim{ 808276792Sdim return __quoted_output_proxy<_CharT, const _CharT *, _Traits> 809276792Sdim ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); 810276792Sdim} 811276792Sdim#endif 812276792Sdim 813276792Sdim_LIBCPP_END_NAMESPACE_STD 814276792Sdim 815276792Sdim#endif // _LIBCPP_LFTS_STRING_VIEW 816