xref: /minix3/external/bsd/libc++/dist/libcxx/include/experimental/string_view (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// -*- C++ -*-
2*0a6a1f1dSLionel Sambuc//===------------------------ string_view ---------------------------------===//
3*0a6a1f1dSLionel Sambuc//
4*0a6a1f1dSLionel Sambuc//                     The LLVM Compiler Infrastructure
5*0a6a1f1dSLionel Sambuc//
6*0a6a1f1dSLionel Sambuc// This file is distributed under the University of Illinois Open Source
7*0a6a1f1dSLionel Sambuc// License. See LICENSE.TXT for details.
8*0a6a1f1dSLionel Sambuc//
9*0a6a1f1dSLionel Sambuc//===----------------------------------------------------------------------===//
10*0a6a1f1dSLionel Sambuc
11*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_LFTS_STRING_VIEW
12*0a6a1f1dSLionel Sambuc#define _LIBCPP_LFTS_STRING_VIEW
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc/*
15*0a6a1f1dSLionel Sambucstring_view synopsis
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel Sambucnamespace std {
18*0a6a1f1dSLionel Sambuc namespace experimental {
19*0a6a1f1dSLionel Sambuc  inline namespace library_fundamentals_v1 {
20*0a6a1f1dSLionel Sambuc
21*0a6a1f1dSLionel Sambuc    // 7.2, Class template basic_string_view
22*0a6a1f1dSLionel Sambuc    template<class charT, class traits = char_traits<charT>>
23*0a6a1f1dSLionel Sambuc        class basic_string_view;
24*0a6a1f1dSLionel Sambuc
25*0a6a1f1dSLionel Sambuc    // 7.9, basic_string_view non-member comparison functions
26*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
27*0a6a1f1dSLionel Sambuc    constexpr bool operator==(basic_string_view<charT, traits> x,
28*0a6a1f1dSLionel Sambuc                              basic_string_view<charT, traits> y) noexcept;
29*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
30*0a6a1f1dSLionel Sambuc    constexpr bool operator!=(basic_string_view<charT, traits> x,
31*0a6a1f1dSLionel Sambuc                              basic_string_view<charT, traits> y) noexcept;
32*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
33*0a6a1f1dSLionel Sambuc    constexpr bool operator< (basic_string_view<charT, traits> x,
34*0a6a1f1dSLionel Sambuc                                 basic_string_view<charT, traits> y) noexcept;
35*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
36*0a6a1f1dSLionel Sambuc    constexpr bool operator> (basic_string_view<charT, traits> x,
37*0a6a1f1dSLionel Sambuc                              basic_string_view<charT, traits> y) noexcept;
38*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
39*0a6a1f1dSLionel Sambuc    constexpr bool operator<=(basic_string_view<charT, traits> x,
40*0a6a1f1dSLionel Sambuc                                 basic_string_view<charT, traits> y) noexcept;
41*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
42*0a6a1f1dSLionel Sambuc    constexpr bool operator>=(basic_string_view<charT, traits> x,
43*0a6a1f1dSLionel Sambuc                              basic_string_view<charT, traits> y) noexcept;
44*0a6a1f1dSLionel Sambuc    // see below, sufficient additional overloads of comparison functions
45*0a6a1f1dSLionel Sambuc
46*0a6a1f1dSLionel Sambuc    // 7.10, Inserters and extractors
47*0a6a1f1dSLionel Sambuc    template<class charT, class traits>
48*0a6a1f1dSLionel Sambuc      basic_ostream<charT, traits>&
49*0a6a1f1dSLionel Sambuc        operator<<(basic_ostream<charT, traits>& os,
50*0a6a1f1dSLionel Sambuc                   basic_string_view<charT, traits> str);
51*0a6a1f1dSLionel Sambuc
52*0a6a1f1dSLionel Sambuc    // basic_string_view typedef names
53*0a6a1f1dSLionel Sambuc    typedef basic_string_view<char> string_view;
54*0a6a1f1dSLionel Sambuc    typedef basic_string_view<char16_t> u16string_view;
55*0a6a1f1dSLionel Sambuc    typedef basic_string_view<char32_t> u32string_view;
56*0a6a1f1dSLionel Sambuc    typedef basic_string_view<wchar_t> wstring_view;
57*0a6a1f1dSLionel Sambuc
58*0a6a1f1dSLionel Sambuc    template<class charT, class traits = char_traits<charT>>
59*0a6a1f1dSLionel Sambuc    class basic_string_view {
60*0a6a1f1dSLionel Sambuc      public:
61*0a6a1f1dSLionel Sambuc      // types
62*0a6a1f1dSLionel Sambuc      typedef traits traits_type;
63*0a6a1f1dSLionel Sambuc      typedef charT value_type;
64*0a6a1f1dSLionel Sambuc      typedef charT* pointer;
65*0a6a1f1dSLionel Sambuc      typedef const charT* const_pointer;
66*0a6a1f1dSLionel Sambuc      typedef charT& reference;
67*0a6a1f1dSLionel Sambuc      typedef const charT& const_reference;
68*0a6a1f1dSLionel Sambuc      typedef implementation-defined const_iterator;
69*0a6a1f1dSLionel Sambuc      typedef const_iterator iterator;
70*0a6a1f1dSLionel Sambuc      typedef reverse_iterator<const_iterator> const_reverse_iterator;
71*0a6a1f1dSLionel Sambuc      typedef const_reverse_iterator reverse_iterator;
72*0a6a1f1dSLionel Sambuc      typedef size_t size_type;
73*0a6a1f1dSLionel Sambuc      typedef ptrdiff_t difference_type;
74*0a6a1f1dSLionel Sambuc      static constexpr size_type npos = size_type(-1);
75*0a6a1f1dSLionel Sambuc
76*0a6a1f1dSLionel Sambuc      // 7.3, basic_string_view constructors and assignment operators
77*0a6a1f1dSLionel Sambuc      constexpr basic_string_view() noexcept;
78*0a6a1f1dSLionel Sambuc      constexpr basic_string_view(const basic_string_view&) noexcept = default;
79*0a6a1f1dSLionel Sambuc      basic_string_view& operator=(const basic_string_view&) noexcept = default;
80*0a6a1f1dSLionel Sambuc      template<class Allocator>
81*0a6a1f1dSLionel Sambuc      basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
82*0a6a1f1dSLionel Sambuc      constexpr basic_string_view(const charT* str);
83*0a6a1f1dSLionel Sambuc      constexpr basic_string_view(const charT* str, size_type len);
84*0a6a1f1dSLionel Sambuc
85*0a6a1f1dSLionel Sambuc      // 7.4, basic_string_view iterator support
86*0a6a1f1dSLionel Sambuc      constexpr const_iterator begin() const noexcept;
87*0a6a1f1dSLionel Sambuc      constexpr const_iterator end() const noexcept;
88*0a6a1f1dSLionel Sambuc      constexpr const_iterator cbegin() const noexcept;
89*0a6a1f1dSLionel Sambuc      constexpr const_iterator cend() const noexcept;
90*0a6a1f1dSLionel Sambuc      const_reverse_iterator rbegin() const noexcept;
91*0a6a1f1dSLionel Sambuc      const_reverse_iterator rend() const noexcept;
92*0a6a1f1dSLionel Sambuc      const_reverse_iterator crbegin() const noexcept;
93*0a6a1f1dSLionel Sambuc      const_reverse_iterator crend() const noexcept;
94*0a6a1f1dSLionel Sambuc
95*0a6a1f1dSLionel Sambuc      // 7.5, basic_string_view capacity
96*0a6a1f1dSLionel Sambuc      constexpr size_type size() const noexcept;
97*0a6a1f1dSLionel Sambuc      constexpr size_type length() const noexcept;
98*0a6a1f1dSLionel Sambuc      constexpr size_type max_size() const noexcept;
99*0a6a1f1dSLionel Sambuc      constexpr bool empty() const noexcept;
100*0a6a1f1dSLionel Sambuc
101*0a6a1f1dSLionel Sambuc      // 7.6, basic_string_view element access
102*0a6a1f1dSLionel Sambuc      constexpr const_reference operator[](size_type pos) const;
103*0a6a1f1dSLionel Sambuc      constexpr const_reference at(size_type pos) const;
104*0a6a1f1dSLionel Sambuc      constexpr const_reference front() const;
105*0a6a1f1dSLionel Sambuc      constexpr const_reference back() const;
106*0a6a1f1dSLionel Sambuc      constexpr const_pointer data() const noexcept;
107*0a6a1f1dSLionel Sambuc
108*0a6a1f1dSLionel Sambuc      // 7.7, basic_string_view modifiers
109*0a6a1f1dSLionel Sambuc      constexpr void clear() noexcept;
110*0a6a1f1dSLionel Sambuc      constexpr void remove_prefix(size_type n);
111*0a6a1f1dSLionel Sambuc      constexpr void remove_suffix(size_type n);
112*0a6a1f1dSLionel Sambuc      constexpr void swap(basic_string_view& s) noexcept;
113*0a6a1f1dSLionel Sambuc
114*0a6a1f1dSLionel Sambuc      // 7.8, basic_string_view string operations
115*0a6a1f1dSLionel Sambuc      template<class Allocator>
116*0a6a1f1dSLionel Sambuc      explicit operator basic_string<charT, traits, Allocator>() const;
117*0a6a1f1dSLionel Sambuc      template<class Allocator = allocator<charT>>
118*0a6a1f1dSLionel Sambuc      basic_string<charT, traits, Allocator> to_string(
119*0a6a1f1dSLionel Sambuc        const Allocator& a = Allocator()) const;
120*0a6a1f1dSLionel Sambuc
121*0a6a1f1dSLionel Sambuc      size_type copy(charT* s, size_type n, size_type pos = 0) const;
122*0a6a1f1dSLionel Sambuc
123*0a6a1f1dSLionel Sambuc      constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
124*0a6a1f1dSLionel Sambuc      constexpr int compare(basic_string_view s) const noexcept;
125*0a6a1f1dSLionel Sambuc      constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
126*0a6a1f1dSLionel Sambuc      constexpr int compare(size_type pos1, size_type n1,
127*0a6a1f1dSLionel Sambuc                            basic_string_view s, size_type pos2, size_type n2) const;
128*0a6a1f1dSLionel Sambuc      constexpr int compare(const charT* s) const;
129*0a6a1f1dSLionel Sambuc      constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
130*0a6a1f1dSLionel Sambuc      constexpr int compare(size_type pos1, size_type n1,
131*0a6a1f1dSLionel Sambuc                            const charT* s, size_type n2) const;
132*0a6a1f1dSLionel Sambuc      constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
133*0a6a1f1dSLionel Sambuc      constexpr size_type find(charT c, size_type pos = 0) const noexcept;
134*0a6a1f1dSLionel Sambuc      constexpr size_type find(const charT* s, size_type pos, size_type n) const;
135*0a6a1f1dSLionel Sambuc      constexpr size_type find(const charT* s, size_type pos = 0) const;
136*0a6a1f1dSLionel Sambuc      constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
137*0a6a1f1dSLionel Sambuc      constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
138*0a6a1f1dSLionel Sambuc      constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
139*0a6a1f1dSLionel Sambuc      constexpr size_type rfind(const charT* s, size_type pos = npos) const;
140*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
141*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
142*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
143*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
144*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
145*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
146*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
147*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
148*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
149*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
150*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
151*0a6a1f1dSLionel Sambuc      constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
152*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
153*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
154*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
155*0a6a1f1dSLionel Sambuc      constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
156*0a6a1f1dSLionel Sambuc
157*0a6a1f1dSLionel Sambuc     private:
158*0a6a1f1dSLionel Sambuc      const_pointer data_;  // exposition only
159*0a6a1f1dSLionel Sambuc      size_type     size_;  // exposition only
160*0a6a1f1dSLionel Sambuc    };
161*0a6a1f1dSLionel Sambuc
162*0a6a1f1dSLionel Sambuc  }  // namespace fundamentals_v1
163*0a6a1f1dSLionel Sambuc }  // namespace experimental
164*0a6a1f1dSLionel Sambuc
165*0a6a1f1dSLionel Sambuc  // 7.11, Hash support
166*0a6a1f1dSLionel Sambuc  template <class T> struct hash;
167*0a6a1f1dSLionel Sambuc  template <> struct hash<experimental::string_view>;
168*0a6a1f1dSLionel Sambuc  template <> struct hash<experimental::u16string_view>;
169*0a6a1f1dSLionel Sambuc  template <> struct hash<experimental::u32string_view>;
170*0a6a1f1dSLionel Sambuc  template <> struct hash<experimental::wstring_view>;
171*0a6a1f1dSLionel Sambuc
172*0a6a1f1dSLionel Sambuc}  // namespace std
173*0a6a1f1dSLionel Sambuc
174*0a6a1f1dSLionel Sambuc
175*0a6a1f1dSLionel Sambuc*/
176*0a6a1f1dSLionel Sambuc
177*0a6a1f1dSLionel Sambuc#include <experimental/__config>
178*0a6a1f1dSLionel Sambuc
179*0a6a1f1dSLionel Sambuc#include <string>
180*0a6a1f1dSLionel Sambuc#include <algorithm>
181*0a6a1f1dSLionel Sambuc#include <iterator>
182*0a6a1f1dSLionel Sambuc#include <ostream>
183*0a6a1f1dSLionel Sambuc#include <iomanip>
184*0a6a1f1dSLionel Sambuc
185*0a6a1f1dSLionel Sambuc#include <__debug>
186*0a6a1f1dSLionel Sambuc
187*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
188*0a6a1f1dSLionel Sambuc#pragma GCC system_header
189*0a6a1f1dSLionel Sambuc#endif
190*0a6a1f1dSLionel Sambuc
191*0a6a1f1dSLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_LFTS
192*0a6a1f1dSLionel Sambuc
193*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
194*0a6a1f1dSLionel Sambuc    class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
195*0a6a1f1dSLionel Sambuc    public:
196*0a6a1f1dSLionel Sambuc        // types
197*0a6a1f1dSLionel Sambuc        typedef _Traits                                    traits_type;
198*0a6a1f1dSLionel Sambuc        typedef _CharT                                     value_type;
199*0a6a1f1dSLionel Sambuc        typedef const _CharT*                              pointer;
200*0a6a1f1dSLionel Sambuc        typedef const _CharT*                              const_pointer;
201*0a6a1f1dSLionel Sambuc        typedef const _CharT&                              reference;
202*0a6a1f1dSLionel Sambuc        typedef const _CharT&                              const_reference;
203*0a6a1f1dSLionel Sambuc        typedef const_pointer                              const_iterator; // See [string.view.iterators]
204*0a6a1f1dSLionel Sambuc        typedef const_iterator                             iterator;
205*0a6a1f1dSLionel Sambuc        typedef _VSTD::reverse_iterator<const_iterator>    const_reverse_iterator;
206*0a6a1f1dSLionel Sambuc        typedef const_reverse_iterator                     reverse_iterator;
207*0a6a1f1dSLionel Sambuc        typedef size_t                                     size_type;
208*0a6a1f1dSLionel Sambuc        typedef ptrdiff_t                                  difference_type;
209*0a6a1f1dSLionel Sambuc        static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
210*0a6a1f1dSLionel Sambuc
211*0a6a1f1dSLionel Sambuc        // [string.view.cons], construct/copy
212*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
213*0a6a1f1dSLionel Sambuc        basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
214*0a6a1f1dSLionel Sambuc
215*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
216*0a6a1f1dSLionel Sambuc        basic_string_view(const basic_string_view&) _NOEXCEPT = default;
217*0a6a1f1dSLionel Sambuc
218*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
219*0a6a1f1dSLionel Sambuc        basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
220*0a6a1f1dSLionel Sambuc
221*0a6a1f1dSLionel Sambuc        template<class _Allocator>
222*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
223*0a6a1f1dSLionel Sambuc        basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
224*0a6a1f1dSLionel Sambuc            : __data (__str.data()), __size(__str.size()) {}
225*0a6a1f1dSLionel Sambuc
226*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
227*0a6a1f1dSLionel Sambuc        basic_string_view(const _CharT* __s, size_type __len)
228*0a6a1f1dSLionel Sambuc            : __data(__s), __size(__len)
229*0a6a1f1dSLionel Sambuc        {
230*0a6a1f1dSLionel Sambuc//             _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr");
231*0a6a1f1dSLionel Sambuc        }
232*0a6a1f1dSLionel Sambuc
233*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
234*0a6a1f1dSLionel Sambuc        basic_string_view(const _CharT* __s)
235*0a6a1f1dSLionel Sambuc            : __data(__s), __size(_Traits::length(__s)) {}
236*0a6a1f1dSLionel Sambuc
237*0a6a1f1dSLionel Sambuc        // [string.view.iterators], iterators
238*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
239*0a6a1f1dSLionel Sambuc        const_iterator begin()  const _NOEXCEPT { return cbegin(); }
240*0a6a1f1dSLionel Sambuc
241*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
242*0a6a1f1dSLionel Sambuc        const_iterator end()    const _NOEXCEPT { return cend(); }
243*0a6a1f1dSLionel Sambuc
244*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
245*0a6a1f1dSLionel Sambuc        const_iterator cbegin() const _NOEXCEPT { return __data; }
246*0a6a1f1dSLionel Sambuc
247*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
248*0a6a1f1dSLionel Sambuc        const_iterator cend()   const _NOEXCEPT { return __data + __size; }
249*0a6a1f1dSLionel Sambuc
250*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
251*0a6a1f1dSLionel Sambuc        const_reverse_iterator rbegin()   const _NOEXCEPT { return const_reverse_iterator(cend()); }
252*0a6a1f1dSLionel Sambuc
253*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
254*0a6a1f1dSLionel Sambuc        const_reverse_iterator rend()     const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
255*0a6a1f1dSLionel Sambuc
256*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
257*0a6a1f1dSLionel Sambuc        const_reverse_iterator crbegin()  const _NOEXCEPT { return const_reverse_iterator(cend()); }
258*0a6a1f1dSLionel Sambuc
259*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
260*0a6a1f1dSLionel Sambuc        const_reverse_iterator crend()    const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
261*0a6a1f1dSLionel Sambuc
262*0a6a1f1dSLionel Sambuc        // [string.view.capacity], capacity
263*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
264*0a6a1f1dSLionel Sambuc        size_type size()     const _NOEXCEPT { return __size; }
265*0a6a1f1dSLionel Sambuc
266*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
267*0a6a1f1dSLionel Sambuc        size_type length()   const _NOEXCEPT { return __size; }
268*0a6a1f1dSLionel Sambuc
269*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
270*0a6a1f1dSLionel Sambuc        size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
271*0a6a1f1dSLionel Sambuc
272*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
273*0a6a1f1dSLionel Sambuc        empty()         const _NOEXCEPT { return __size == 0; }
274*0a6a1f1dSLionel Sambuc
275*0a6a1f1dSLionel Sambuc        // [string.view.access], element access
276*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
277*0a6a1f1dSLionel Sambuc        const_reference operator[](size_type __pos) const { return __data[__pos]; }
278*0a6a1f1dSLionel Sambuc
279*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
280*0a6a1f1dSLionel Sambuc        const_reference at(size_type __pos) const
281*0a6a1f1dSLionel Sambuc        {
282*0a6a1f1dSLionel Sambuc            return __pos >= size()
283*0a6a1f1dSLionel Sambuc                ? (throw out_of_range("string_view::at"), __data[0])
284*0a6a1f1dSLionel Sambuc                : __data[__pos];
285*0a6a1f1dSLionel Sambuc        }
286*0a6a1f1dSLionel Sambuc
287*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
288*0a6a1f1dSLionel Sambuc        const_reference front() const
289*0a6a1f1dSLionel Sambuc        {
290*0a6a1f1dSLionel Sambuc            return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
291*0a6a1f1dSLionel Sambuc        }
292*0a6a1f1dSLionel Sambuc
293*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
294*0a6a1f1dSLionel Sambuc        const_reference back() const
295*0a6a1f1dSLionel Sambuc        {
296*0a6a1f1dSLionel Sambuc            return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
297*0a6a1f1dSLionel Sambuc        }
298*0a6a1f1dSLionel Sambuc
299*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
300*0a6a1f1dSLionel Sambuc        const_pointer data() const _NOEXCEPT { return __data; }
301*0a6a1f1dSLionel Sambuc
302*0a6a1f1dSLionel Sambuc        // [string.view.modifiers], modifiers:
303*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
304*0a6a1f1dSLionel Sambuc        void clear() _NOEXCEPT
305*0a6a1f1dSLionel Sambuc        {
306*0a6a1f1dSLionel Sambuc            __data = nullptr;
307*0a6a1f1dSLionel Sambuc            __size = 0;
308*0a6a1f1dSLionel Sambuc        }
309*0a6a1f1dSLionel Sambuc
310*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
311*0a6a1f1dSLionel Sambuc        void remove_prefix(size_type __n) _NOEXCEPT
312*0a6a1f1dSLionel Sambuc        {
313*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
314*0a6a1f1dSLionel Sambuc            __data += __n;
315*0a6a1f1dSLionel Sambuc            __size -= __n;
316*0a6a1f1dSLionel Sambuc        }
317*0a6a1f1dSLionel Sambuc
318*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
319*0a6a1f1dSLionel Sambuc        void remove_suffix(size_type __n) _NOEXCEPT
320*0a6a1f1dSLionel Sambuc        {
321*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
322*0a6a1f1dSLionel Sambuc            __size -= __n;
323*0a6a1f1dSLionel Sambuc        }
324*0a6a1f1dSLionel Sambuc
325*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
326*0a6a1f1dSLionel Sambuc        void swap(basic_string_view& __other) _NOEXCEPT
327*0a6a1f1dSLionel Sambuc        {
328*0a6a1f1dSLionel Sambuc            const value_type *__p = __data;
329*0a6a1f1dSLionel Sambuc            __data = __other.__data;
330*0a6a1f1dSLionel Sambuc            __other.__data = __p;
331*0a6a1f1dSLionel Sambuc
332*0a6a1f1dSLionel Sambuc            size_type __sz = __size;
333*0a6a1f1dSLionel Sambuc            __size = __other.__size;
334*0a6a1f1dSLionel Sambuc            __other.__size = __sz;
335*0a6a1f1dSLionel Sambuc//             _VSTD::swap( __data, __other.__data );
336*0a6a1f1dSLionel Sambuc//             _VSTD::swap( __size, __other.__size );
337*0a6a1f1dSLionel Sambuc        }
338*0a6a1f1dSLionel Sambuc
339*0a6a1f1dSLionel Sambuc        // [string.view.ops], string operations:
340*0a6a1f1dSLionel Sambuc        template<class _Allocator>
341*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
342*0a6a1f1dSLionel Sambuc        _LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
343*0a6a1f1dSLionel Sambuc        { return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
344*0a6a1f1dSLionel Sambuc
345*0a6a1f1dSLionel Sambuc        template<class _Allocator = allocator<_CharT> >
346*0a6a1f1dSLionel Sambuc        _LIBCPP_INLINE_VISIBILITY
347*0a6a1f1dSLionel Sambuc        basic_string<_CharT, _Traits, _Allocator>
348*0a6a1f1dSLionel Sambuc        to_string( const _Allocator& __a = _Allocator()) const
349*0a6a1f1dSLionel Sambuc        { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
350*0a6a1f1dSLionel Sambuc
351*0a6a1f1dSLionel Sambuc        size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
352*0a6a1f1dSLionel Sambuc        {
353*0a6a1f1dSLionel Sambuc            if ( __pos > size())
354*0a6a1f1dSLionel Sambuc                throw out_of_range("string_view::copy");
355*0a6a1f1dSLionel Sambuc            size_type __rlen = _VSTD::min( __n, size() - __pos );
356*0a6a1f1dSLionel Sambuc            _VSTD::copy_n(begin() + __pos, __rlen, __s );
357*0a6a1f1dSLionel Sambuc            return __rlen;
358*0a6a1f1dSLionel Sambuc        }
359*0a6a1f1dSLionel Sambuc
360*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR
361*0a6a1f1dSLionel Sambuc        basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
362*0a6a1f1dSLionel Sambuc        {
363*0a6a1f1dSLionel Sambuc//             if (__pos > size())
364*0a6a1f1dSLionel Sambuc//                 throw out_of_range("string_view::substr");
365*0a6a1f1dSLionel Sambuc//             size_type __rlen = _VSTD::min( __n, size() - __pos );
366*0a6a1f1dSLionel Sambuc//             return basic_string_view(data() + __pos, __rlen);
367*0a6a1f1dSLionel Sambuc            return __pos > size()
368*0a6a1f1dSLionel Sambuc                ? throw out_of_range("string_view::substr")
369*0a6a1f1dSLionel Sambuc                : basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
370*0a6a1f1dSLionel Sambuc        }
371*0a6a1f1dSLionel Sambuc
372*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
373*0a6a1f1dSLionel Sambuc        {
374*0a6a1f1dSLionel Sambuc            size_type __rlen = _VSTD::min( size(), __sv.size());
375*0a6a1f1dSLionel Sambuc            int __retval = _Traits::compare(data(), __sv.data(), __rlen);
376*0a6a1f1dSLionel Sambuc            if ( __retval == 0 ) // first __rlen chars matched
377*0a6a1f1dSLionel Sambuc                __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
378*0a6a1f1dSLionel Sambuc            return __retval;
379*0a6a1f1dSLionel Sambuc        }
380*0a6a1f1dSLionel Sambuc
381*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
382*0a6a1f1dSLionel Sambuc        int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
383*0a6a1f1dSLionel Sambuc        {
384*0a6a1f1dSLionel Sambuc            return substr(__pos1, __n1).compare(__sv);
385*0a6a1f1dSLionel Sambuc        }
386*0a6a1f1dSLionel Sambuc
387*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
388*0a6a1f1dSLionel Sambuc        int compare(                       size_type __pos1, size_type __n1,
389*0a6a1f1dSLionel Sambuc                    basic_string_view _sv, size_type __pos2, size_type __n2) const
390*0a6a1f1dSLionel Sambuc        {
391*0a6a1f1dSLionel Sambuc            return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
392*0a6a1f1dSLionel Sambuc        }
393*0a6a1f1dSLionel Sambuc
394*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
395*0a6a1f1dSLionel Sambuc        int compare(const _CharT* __s) const
396*0a6a1f1dSLionel Sambuc        {
397*0a6a1f1dSLionel Sambuc            return compare(basic_string_view(__s));
398*0a6a1f1dSLionel Sambuc        }
399*0a6a1f1dSLionel Sambuc
400*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
401*0a6a1f1dSLionel Sambuc        int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
402*0a6a1f1dSLionel Sambuc        {
403*0a6a1f1dSLionel Sambuc            return substr(__pos1, __n1).compare(basic_string_view(__s));
404*0a6a1f1dSLionel Sambuc        }
405*0a6a1f1dSLionel Sambuc
406*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
407*0a6a1f1dSLionel Sambuc        int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
408*0a6a1f1dSLionel Sambuc        {
409*0a6a1f1dSLionel Sambuc            return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
410*0a6a1f1dSLionel Sambuc        }
411*0a6a1f1dSLionel Sambuc
412*0a6a1f1dSLionel Sambuc        // find
413*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
414*0a6a1f1dSLionel Sambuc        size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
415*0a6a1f1dSLionel Sambuc        {
416*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
417*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
418*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
419*0a6a1f1dSLionel Sambuc        }
420*0a6a1f1dSLionel Sambuc
421*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
422*0a6a1f1dSLionel Sambuc        size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
423*0a6a1f1dSLionel Sambuc        {
424*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
425*0a6a1f1dSLionel Sambuc                (data(), size(), __c, __pos);
426*0a6a1f1dSLionel Sambuc        }
427*0a6a1f1dSLionel Sambuc
428*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
429*0a6a1f1dSLionel Sambuc        size_type find(const _CharT* __s, size_type __pos, size_type __n) const
430*0a6a1f1dSLionel Sambuc        {
431*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr");
432*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
433*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
434*0a6a1f1dSLionel Sambuc        }
435*0a6a1f1dSLionel Sambuc
436*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
437*0a6a1f1dSLionel Sambuc        size_type find(const _CharT* __s, size_type __pos = 0) const
438*0a6a1f1dSLionel Sambuc        {
439*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr");
440*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find<value_type, size_type, traits_type, npos>
441*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
442*0a6a1f1dSLionel Sambuc        }
443*0a6a1f1dSLionel Sambuc
444*0a6a1f1dSLionel Sambuc        // rfind
445*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
446*0a6a1f1dSLionel Sambuc        size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
447*0a6a1f1dSLionel Sambuc        {
448*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
449*0a6a1f1dSLionel Sambuc            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
450*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
451*0a6a1f1dSLionel Sambuc        }
452*0a6a1f1dSLionel Sambuc
453*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
454*0a6a1f1dSLionel Sambuc        size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
455*0a6a1f1dSLionel Sambuc        {
456*0a6a1f1dSLionel Sambuc            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
457*0a6a1f1dSLionel Sambuc                (data(), size(), __c, __pos);
458*0a6a1f1dSLionel Sambuc        }
459*0a6a1f1dSLionel Sambuc
460*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
461*0a6a1f1dSLionel Sambuc        size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
462*0a6a1f1dSLionel Sambuc        {
463*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr");
464*0a6a1f1dSLionel Sambuc            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
465*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
466*0a6a1f1dSLionel Sambuc        }
467*0a6a1f1dSLionel Sambuc
468*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
469*0a6a1f1dSLionel Sambuc        size_type rfind(const _CharT* __s, size_type __pos=npos) const
470*0a6a1f1dSLionel Sambuc        {
471*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr");
472*0a6a1f1dSLionel Sambuc            return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
473*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
474*0a6a1f1dSLionel Sambuc        }
475*0a6a1f1dSLionel Sambuc
476*0a6a1f1dSLionel Sambuc        // find_first_of
477*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
478*0a6a1f1dSLionel Sambuc        size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
479*0a6a1f1dSLionel Sambuc        {
480*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr");
481*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
482*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
483*0a6a1f1dSLionel Sambuc        }
484*0a6a1f1dSLionel Sambuc
485*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
486*0a6a1f1dSLionel Sambuc        size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
487*0a6a1f1dSLionel Sambuc        { return find(__c, __pos); }
488*0a6a1f1dSLionel Sambuc
489*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
490*0a6a1f1dSLionel Sambuc        size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
491*0a6a1f1dSLionel Sambuc        {
492*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr");
493*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
494*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
495*0a6a1f1dSLionel Sambuc        }
496*0a6a1f1dSLionel Sambuc
497*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
498*0a6a1f1dSLionel Sambuc        size_type find_first_of(const _CharT* __s, size_type __pos=0) const
499*0a6a1f1dSLionel Sambuc        {
500*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr");
501*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
502*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
503*0a6a1f1dSLionel Sambuc        }
504*0a6a1f1dSLionel Sambuc
505*0a6a1f1dSLionel Sambuc        // find_last_of
506*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
507*0a6a1f1dSLionel Sambuc        size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
508*0a6a1f1dSLionel Sambuc        {
509*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr");
510*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
511*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
512*0a6a1f1dSLionel Sambuc        }
513*0a6a1f1dSLionel Sambuc
514*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
515*0a6a1f1dSLionel Sambuc        size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
516*0a6a1f1dSLionel Sambuc        { return rfind(__c, __pos); }
517*0a6a1f1dSLionel Sambuc
518*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
519*0a6a1f1dSLionel Sambuc        size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
520*0a6a1f1dSLionel Sambuc        {
521*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr");
522*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
523*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
524*0a6a1f1dSLionel Sambuc        }
525*0a6a1f1dSLionel Sambuc
526*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
527*0a6a1f1dSLionel Sambuc        size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
528*0a6a1f1dSLionel Sambuc        {
529*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr");
530*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
531*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
532*0a6a1f1dSLionel Sambuc        }
533*0a6a1f1dSLionel Sambuc
534*0a6a1f1dSLionel Sambuc        // find_first_not_of
535*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
536*0a6a1f1dSLionel Sambuc        size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
537*0a6a1f1dSLionel Sambuc        {
538*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr");
539*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
540*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
541*0a6a1f1dSLionel Sambuc        }
542*0a6a1f1dSLionel Sambuc
543*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
544*0a6a1f1dSLionel Sambuc        size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
545*0a6a1f1dSLionel Sambuc        {
546*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
547*0a6a1f1dSLionel Sambuc                (data(), size(), __c, __pos);
548*0a6a1f1dSLionel Sambuc        }
549*0a6a1f1dSLionel Sambuc
550*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
551*0a6a1f1dSLionel Sambuc        size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
552*0a6a1f1dSLionel Sambuc        {
553*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
554*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
555*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
556*0a6a1f1dSLionel Sambuc        }
557*0a6a1f1dSLionel Sambuc
558*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
559*0a6a1f1dSLionel Sambuc        size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
560*0a6a1f1dSLionel Sambuc        {
561*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
562*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
563*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
564*0a6a1f1dSLionel Sambuc        }
565*0a6a1f1dSLionel Sambuc
566*0a6a1f1dSLionel Sambuc        // find_last_not_of
567*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
568*0a6a1f1dSLionel Sambuc        size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
569*0a6a1f1dSLionel Sambuc        {
570*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr");
571*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
572*0a6a1f1dSLionel Sambuc                (data(), size(), __s.data(), __pos, __s.size());
573*0a6a1f1dSLionel Sambuc        }
574*0a6a1f1dSLionel Sambuc
575*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
576*0a6a1f1dSLionel Sambuc        size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
577*0a6a1f1dSLionel Sambuc        {
578*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
579*0a6a1f1dSLionel Sambuc                (data(), size(), __c, __pos);
580*0a6a1f1dSLionel Sambuc        }
581*0a6a1f1dSLionel Sambuc
582*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
583*0a6a1f1dSLionel Sambuc        size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
584*0a6a1f1dSLionel Sambuc        {
585*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
586*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
587*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, __n);
588*0a6a1f1dSLionel Sambuc        }
589*0a6a1f1dSLionel Sambuc
590*0a6a1f1dSLionel Sambuc        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
591*0a6a1f1dSLionel Sambuc        size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
592*0a6a1f1dSLionel Sambuc        {
593*0a6a1f1dSLionel Sambuc            _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
594*0a6a1f1dSLionel Sambuc            return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
595*0a6a1f1dSLionel Sambuc                (data(), size(), __s, __pos, traits_type::length(__s));
596*0a6a1f1dSLionel Sambuc        }
597*0a6a1f1dSLionel Sambuc
598*0a6a1f1dSLionel Sambuc    private:
599*0a6a1f1dSLionel Sambuc        const   value_type* __data;
600*0a6a1f1dSLionel Sambuc        size_type           __size;
601*0a6a1f1dSLionel Sambuc    };
602*0a6a1f1dSLionel Sambuc
603*0a6a1f1dSLionel Sambuc
604*0a6a1f1dSLionel Sambuc    // [string.view.comparison]
605*0a6a1f1dSLionel Sambuc    // operator ==
606*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
607*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
608*0a6a1f1dSLionel Sambuc    bool operator==(basic_string_view<_CharT, _Traits> __lhs,
609*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
610*0a6a1f1dSLionel Sambuc    {
611*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size()) return false;
612*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) == 0;
613*0a6a1f1dSLionel Sambuc    }
614*0a6a1f1dSLionel Sambuc
615*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
616*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
617*0a6a1f1dSLionel Sambuc    bool operator==(basic_string_view<_CharT, _Traits> __lhs,
618*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
619*0a6a1f1dSLionel Sambuc    {
620*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size()) return false;
621*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) == 0;
622*0a6a1f1dSLionel Sambuc    }
623*0a6a1f1dSLionel Sambuc
624*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
625*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
626*0a6a1f1dSLionel Sambuc    bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
627*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
628*0a6a1f1dSLionel Sambuc    {
629*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size()) return false;
630*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) == 0;
631*0a6a1f1dSLionel Sambuc    }
632*0a6a1f1dSLionel Sambuc
633*0a6a1f1dSLionel Sambuc
634*0a6a1f1dSLionel Sambuc    // operator !=
635*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
636*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
637*0a6a1f1dSLionel Sambuc    bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
638*0a6a1f1dSLionel Sambuc    {
639*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size())
640*0a6a1f1dSLionel Sambuc            return true;
641*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) != 0;
642*0a6a1f1dSLionel Sambuc    }
643*0a6a1f1dSLionel Sambuc
644*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
645*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
646*0a6a1f1dSLionel Sambuc    bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
647*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
648*0a6a1f1dSLionel Sambuc    {
649*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size())
650*0a6a1f1dSLionel Sambuc            return true;
651*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) != 0;
652*0a6a1f1dSLionel Sambuc    }
653*0a6a1f1dSLionel Sambuc
654*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
655*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
656*0a6a1f1dSLionel Sambuc    bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
657*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
658*0a6a1f1dSLionel Sambuc    {
659*0a6a1f1dSLionel Sambuc        if ( __lhs.size() != __rhs.size())
660*0a6a1f1dSLionel Sambuc            return true;
661*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) != 0;
662*0a6a1f1dSLionel Sambuc    }
663*0a6a1f1dSLionel Sambuc
664*0a6a1f1dSLionel Sambuc
665*0a6a1f1dSLionel Sambuc    // operator <
666*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
667*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
668*0a6a1f1dSLionel Sambuc    bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
669*0a6a1f1dSLionel Sambuc    {
670*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) < 0;
671*0a6a1f1dSLionel Sambuc    }
672*0a6a1f1dSLionel Sambuc
673*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
674*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
675*0a6a1f1dSLionel Sambuc    bool operator<(basic_string_view<_CharT, _Traits> __lhs,
676*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
677*0a6a1f1dSLionel Sambuc    {
678*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) < 0;
679*0a6a1f1dSLionel Sambuc    }
680*0a6a1f1dSLionel Sambuc
681*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
682*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
683*0a6a1f1dSLionel Sambuc    bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
684*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
685*0a6a1f1dSLionel Sambuc    {
686*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) < 0;
687*0a6a1f1dSLionel Sambuc    }
688*0a6a1f1dSLionel Sambuc
689*0a6a1f1dSLionel Sambuc
690*0a6a1f1dSLionel Sambuc    // operator >
691*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
692*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
693*0a6a1f1dSLionel Sambuc    bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
694*0a6a1f1dSLionel Sambuc    {
695*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) > 0;
696*0a6a1f1dSLionel Sambuc    }
697*0a6a1f1dSLionel Sambuc
698*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
699*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
700*0a6a1f1dSLionel Sambuc    bool operator>(basic_string_view<_CharT, _Traits> __lhs,
701*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
702*0a6a1f1dSLionel Sambuc    {
703*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) > 0;
704*0a6a1f1dSLionel Sambuc    }
705*0a6a1f1dSLionel Sambuc
706*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
707*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
708*0a6a1f1dSLionel Sambuc    bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
709*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
710*0a6a1f1dSLionel Sambuc    {
711*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) > 0;
712*0a6a1f1dSLionel Sambuc    }
713*0a6a1f1dSLionel Sambuc
714*0a6a1f1dSLionel Sambuc
715*0a6a1f1dSLionel Sambuc    // operator <=
716*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
717*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
718*0a6a1f1dSLionel Sambuc    bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
719*0a6a1f1dSLionel Sambuc    {
720*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) <= 0;
721*0a6a1f1dSLionel Sambuc    }
722*0a6a1f1dSLionel Sambuc
723*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
724*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
725*0a6a1f1dSLionel Sambuc    bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
726*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
727*0a6a1f1dSLionel Sambuc    {
728*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) <= 0;
729*0a6a1f1dSLionel Sambuc    }
730*0a6a1f1dSLionel Sambuc
731*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
732*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
733*0a6a1f1dSLionel Sambuc    bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
734*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
735*0a6a1f1dSLionel Sambuc    {
736*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) <= 0;
737*0a6a1f1dSLionel Sambuc    }
738*0a6a1f1dSLionel Sambuc
739*0a6a1f1dSLionel Sambuc
740*0a6a1f1dSLionel Sambuc    // operator >=
741*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
742*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
743*0a6a1f1dSLionel Sambuc    bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
744*0a6a1f1dSLionel Sambuc    {
745*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) >= 0;
746*0a6a1f1dSLionel Sambuc    }
747*0a6a1f1dSLionel Sambuc
748*0a6a1f1dSLionel Sambuc
749*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
750*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
751*0a6a1f1dSLionel Sambuc    bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
752*0a6a1f1dSLionel Sambuc                    typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
753*0a6a1f1dSLionel Sambuc    {
754*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) >= 0;
755*0a6a1f1dSLionel Sambuc    }
756*0a6a1f1dSLionel Sambuc
757*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
758*0a6a1f1dSLionel Sambuc    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
759*0a6a1f1dSLionel Sambuc    bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
760*0a6a1f1dSLionel Sambuc                    basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
761*0a6a1f1dSLionel Sambuc    {
762*0a6a1f1dSLionel Sambuc        return __lhs.compare(__rhs) >= 0;
763*0a6a1f1dSLionel Sambuc    }
764*0a6a1f1dSLionel Sambuc
765*0a6a1f1dSLionel Sambuc
766*0a6a1f1dSLionel Sambuc    // [string.view.io]
767*0a6a1f1dSLionel Sambuc    template<class _CharT, class _Traits>
768*0a6a1f1dSLionel Sambuc    basic_ostream<_CharT, _Traits>&
769*0a6a1f1dSLionel Sambuc    operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
770*0a6a1f1dSLionel Sambuc    {
771*0a6a1f1dSLionel Sambuc        return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
772*0a6a1f1dSLionel Sambuc    }
773*0a6a1f1dSLionel Sambuc
774*0a6a1f1dSLionel Sambuc  typedef basic_string_view<char>     string_view;
775*0a6a1f1dSLionel Sambuc  typedef basic_string_view<char16_t> u16string_view;
776*0a6a1f1dSLionel Sambuc  typedef basic_string_view<char32_t> u32string_view;
777*0a6a1f1dSLionel Sambuc  typedef basic_string_view<wchar_t>  wstring_view;
778*0a6a1f1dSLionel Sambuc
779*0a6a1f1dSLionel Sambuc_LIBCPP_END_NAMESPACE_LFTS
780*0a6a1f1dSLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
781*0a6a1f1dSLionel Sambuc
782*0a6a1f1dSLionel Sambuc// [string.view.hash]
783*0a6a1f1dSLionel Sambuc// Shamelessly stolen from <string>
784*0a6a1f1dSLionel Sambuctemplate<class _CharT, class _Traits>
785*0a6a1f1dSLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
786*0a6a1f1dSLionel Sambuc    : public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
787*0a6a1f1dSLionel Sambuc{
788*0a6a1f1dSLionel Sambuc    size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
789*0a6a1f1dSLionel Sambuc};
790*0a6a1f1dSLionel Sambuc
791*0a6a1f1dSLionel Sambuctemplate<class _CharT, class _Traits>
792*0a6a1f1dSLionel Sambucsize_t
793*0a6a1f1dSLionel Sambuchash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
794*0a6a1f1dSLionel Sambuc        const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
795*0a6a1f1dSLionel Sambuc{
796*0a6a1f1dSLionel Sambuc    return __do_string_hash(__val.data(), __val.data() + __val.size());
797*0a6a1f1dSLionel Sambuc}
798*0a6a1f1dSLionel Sambuc
799*0a6a1f1dSLionel Sambuc#if _LIBCPP_STD_VER > 11
800*0a6a1f1dSLionel Sambuctemplate <class _CharT, class _Traits>
801*0a6a1f1dSLionel Sambuc__quoted_output_proxy<_CharT, const _CharT *, _Traits>
802*0a6a1f1dSLionel Sambucquoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
803*0a6a1f1dSLionel Sambuc             _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
804*0a6a1f1dSLionel Sambuc{
805*0a6a1f1dSLionel Sambuc    return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
806*0a6a1f1dSLionel Sambuc         ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
807*0a6a1f1dSLionel Sambuc}
808*0a6a1f1dSLionel Sambuc#endif
809*0a6a1f1dSLionel Sambuc
810*0a6a1f1dSLionel Sambuc_LIBCPP_END_NAMESPACE_STD
811*0a6a1f1dSLionel Sambuc
812*0a6a1f1dSLionel Sambuc#endif // _LIBCPP_LFTS_STRING_VIEW
813