| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 1 | // -*- C++ -*- | 
|  | 2 | //===-------------------------- __string ----------------------------------===// | 
|  | 3 | // | 
|  | 4 | //                     The LLVM Compiler Infrastructure | 
|  | 5 | // | 
|  | 6 | // This file is distributed under the University of Illinois Open Source | 
|  | 7 | // License. See LICENSE.TXT for details. | 
|  | 8 | // | 
|  | 9 | //===----------------------------------------------------------------------===// | 
|  | 10 |  | 
|  | 11 | #ifndef _LIBCPP___STRING | 
|  | 12 | #define _LIBCPP___STRING | 
|  | 13 |  | 
|  | 14 | /* | 
|  | 15 | string synopsis | 
|  | 16 |  | 
|  | 17 | namespace std | 
|  | 18 | { | 
|  | 19 |  | 
|  | 20 | template <class charT> | 
|  | 21 | struct char_traits | 
|  | 22 | { | 
|  | 23 | typedef charT     char_type; | 
|  | 24 | typedef ...       int_type; | 
|  | 25 | typedef streamoff off_type; | 
|  | 26 | typedef streampos pos_type; | 
|  | 27 | typedef mbstate_t state_type; | 
|  | 28 |  | 
|  | 29 | static void assign(char_type& c1, const char_type& c2) noexcept; | 
|  | 30 | static constexpr bool eq(char_type c1, char_type c2) noexcept; | 
|  | 31 | static constexpr bool lt(char_type c1, char_type c2) noexcept; | 
|  | 32 |  | 
|  | 33 | static int              compare(const char_type* s1, const char_type* s2, size_t n); | 
|  | 34 | static size_t           length(const char_type* s); | 
|  | 35 | static const char_type* find(const char_type* s, size_t n, const char_type& a); | 
|  | 36 | static char_type*       move(char_type* s1, const char_type* s2, size_t n); | 
|  | 37 | static char_type*       copy(char_type* s1, const char_type* s2, size_t n); | 
|  | 38 | static char_type*       assign(char_type* s, size_t n, char_type a); | 
|  | 39 |  | 
|  | 40 | static constexpr int_type  not_eof(int_type c) noexcept; | 
|  | 41 | static constexpr char_type to_char_type(int_type c) noexcept; | 
|  | 42 | static constexpr int_type  to_int_type(char_type c) noexcept; | 
|  | 43 | static constexpr bool      eq_int_type(int_type c1, int_type c2) noexcept; | 
|  | 44 | static constexpr int_type  eof() noexcept; | 
|  | 45 | }; | 
|  | 46 |  | 
|  | 47 | template <> struct char_traits<char>; | 
|  | 48 | template <> struct char_traits<wchar_t>; | 
|  | 49 |  | 
|  | 50 | }  // std | 
|  | 51 |  | 
|  | 52 | */ | 
|  | 53 |  | 
|  | 54 | #include <__config> | 
|  | 55 | #include <algorithm>  // for search and min | 
|  | 56 | #include <cstdio>     // For EOF. | 
|  | 57 | #include <memory>     // for __murmur2_or_cityhash | 
|  | 58 |  | 
|  | 59 | #include <__undef_min_max> | 
|  | 60 |  | 
|  | 61 | #include <__debug> | 
|  | 62 |  | 
|  | 63 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
|  | 64 | #pragma GCC system_header | 
|  | 65 | #endif | 
|  | 66 |  | 
|  | 67 | _LIBCPP_BEGIN_NAMESPACE_STD | 
|  | 68 |  | 
|  | 69 | // char_traits | 
|  | 70 |  | 
|  | 71 | template <class _CharT> | 
|  | 72 | struct _LIBCPP_TYPE_VIS_ONLY char_traits | 
|  | 73 | { | 
|  | 74 | typedef _CharT    char_type; | 
|  | 75 | typedef int       int_type; | 
|  | 76 | typedef streamoff off_type; | 
|  | 77 | typedef streampos pos_type; | 
|  | 78 | typedef mbstate_t state_type; | 
|  | 79 |  | 
|  | 80 | static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT | 
|  | 81 | {__c1 = __c2;} | 
|  | 82 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 83 | {return __c1 == __c2;} | 
|  | 84 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 85 | {return __c1 < __c2;} | 
|  | 86 |  | 
|  | 87 | static int              compare(const char_type* __s1, const char_type* __s2, size_t __n); | 
|  | 88 | _LIBCPP_INLINE_VISIBILITY | 
|  | 89 | static size_t           length(const char_type* __s); | 
|  | 90 | _LIBCPP_INLINE_VISIBILITY | 
|  | 91 | static const char_type* find(const char_type* __s, size_t __n, const char_type& __a); | 
|  | 92 | static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n); | 
|  | 93 | _LIBCPP_INLINE_VISIBILITY | 
|  | 94 | static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n); | 
|  | 95 | _LIBCPP_INLINE_VISIBILITY | 
|  | 96 | static char_type*       assign(char_type* __s, size_t __n, char_type __a); | 
|  | 97 |  | 
|  | 98 | static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT | 
|  | 99 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} | 
|  | 100 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT | 
|  | 101 | {return char_type(__c);} | 
|  | 102 | static inline _LIBCPP_CONSTEXPR int_type  to_int_type(char_type __c) _NOEXCEPT | 
|  | 103 | {return int_type(__c);} | 
|  | 104 | static inline _LIBCPP_CONSTEXPR bool      eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT | 
|  | 105 | {return __c1 == __c2;} | 
|  | 106 | static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT | 
|  | 107 | {return int_type(EOF);} | 
|  | 108 | }; | 
|  | 109 |  | 
|  | 110 | template <class _CharT> | 
|  | 111 | int | 
|  | 112 | char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) | 
|  | 113 | { | 
|  | 114 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 115 | { | 
|  | 116 | if (lt(*__s1, *__s2)) | 
|  | 117 | return -1; | 
|  | 118 | if (lt(*__s2, *__s1)) | 
|  | 119 | return 1; | 
|  | 120 | } | 
|  | 121 | return 0; | 
|  | 122 | } | 
|  | 123 |  | 
|  | 124 | template <class _CharT> | 
|  | 125 | inline | 
|  | 126 | size_t | 
|  | 127 | char_traits<_CharT>::length(const char_type* __s) | 
|  | 128 | { | 
|  | 129 | size_t __len = 0; | 
|  | 130 | for (; !eq(*__s, char_type(0)); ++__s) | 
|  | 131 | ++__len; | 
|  | 132 | return __len; | 
|  | 133 | } | 
|  | 134 |  | 
|  | 135 | template <class _CharT> | 
|  | 136 | inline | 
|  | 137 | const _CharT* | 
|  | 138 | char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) | 
|  | 139 | { | 
|  | 140 | for (; __n; --__n) | 
|  | 141 | { | 
|  | 142 | if (eq(*__s, __a)) | 
|  | 143 | return __s; | 
|  | 144 | ++__s; | 
|  | 145 | } | 
|  | 146 | return 0; | 
|  | 147 | } | 
|  | 148 |  | 
|  | 149 | template <class _CharT> | 
|  | 150 | _CharT* | 
|  | 151 | char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) | 
|  | 152 | { | 
|  | 153 | char_type* __r = __s1; | 
|  | 154 | if (__s1 < __s2) | 
|  | 155 | { | 
|  | 156 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 157 | assign(*__s1, *__s2); | 
|  | 158 | } | 
|  | 159 | else if (__s2 < __s1) | 
|  | 160 | { | 
|  | 161 | __s1 += __n; | 
|  | 162 | __s2 += __n; | 
|  | 163 | for (; __n; --__n) | 
|  | 164 | assign(*--__s1, *--__s2); | 
|  | 165 | } | 
|  | 166 | return __r; | 
|  | 167 | } | 
|  | 168 |  | 
|  | 169 | template <class _CharT> | 
|  | 170 | inline | 
|  | 171 | _CharT* | 
|  | 172 | char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) | 
|  | 173 | { | 
|  | 174 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | 
|  | 175 | char_type* __r = __s1; | 
|  | 176 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 177 | assign(*__s1, *__s2); | 
|  | 178 | return __r; | 
|  | 179 | } | 
|  | 180 |  | 
|  | 181 | template <class _CharT> | 
|  | 182 | inline | 
|  | 183 | _CharT* | 
|  | 184 | char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) | 
|  | 185 | { | 
|  | 186 | char_type* __r = __s; | 
|  | 187 | for (; __n; --__n, ++__s) | 
|  | 188 | assign(*__s, __a); | 
|  | 189 | return __r; | 
|  | 190 | } | 
|  | 191 |  | 
|  | 192 | // char_traits<char> | 
|  | 193 |  | 
|  | 194 | template <> | 
|  | 195 | struct _LIBCPP_TYPE_VIS_ONLY char_traits<char> | 
|  | 196 | { | 
|  | 197 | typedef char      char_type; | 
|  | 198 | typedef int       int_type; | 
|  | 199 | typedef streamoff off_type; | 
|  | 200 | typedef streampos pos_type; | 
|  | 201 | typedef mbstate_t state_type; | 
|  | 202 |  | 
|  | 203 | static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT | 
|  | 204 | {__c1 = __c2;} | 
|  | 205 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 206 | {return __c1 == __c2;} | 
|  | 207 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 208 | {return (unsigned char)__c1 < (unsigned char)__c2;} | 
|  | 209 |  | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 210 | static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 211 | {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 212 | static inline size_t length(const char_type* __s)  _NOEXCEPT {return strlen(__s);} | 
|  | 213 | static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 214 | {return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 215 | static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 216 | {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 217 | static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 218 | { | 
|  | 219 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | 
|  | 220 | return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); | 
|  | 221 | } | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 222 | static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 223 | {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} | 
|  | 224 |  | 
|  | 225 | static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT | 
|  | 226 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} | 
|  | 227 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT | 
|  | 228 | {return char_type(__c);} | 
|  | 229 | static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT | 
|  | 230 | {return int_type((unsigned char)__c);} | 
|  | 231 | static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT | 
|  | 232 | {return __c1 == __c2;} | 
|  | 233 | static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT | 
|  | 234 | {return int_type(EOF);} | 
|  | 235 | }; | 
|  | 236 |  | 
|  | 237 | // char_traits<wchar_t> | 
|  | 238 |  | 
|  | 239 | template <> | 
|  | 240 | struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t> | 
|  | 241 | { | 
|  | 242 | typedef wchar_t   char_type; | 
|  | 243 | typedef wint_t    int_type; | 
|  | 244 | typedef streamoff off_type; | 
|  | 245 | typedef streampos pos_type; | 
|  | 246 | typedef mbstate_t state_type; | 
|  | 247 |  | 
|  | 248 | static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT | 
|  | 249 | {__c1 = __c2;} | 
|  | 250 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 251 | {return __c1 == __c2;} | 
|  | 252 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 253 | {return __c1 < __c2;} | 
|  | 254 |  | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 255 | static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 256 | {return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 257 | static inline size_t length(const char_type* __s) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 258 | {return wcslen(__s);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 259 | static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 260 | {return __n == 0 ? NULL : (const char_type*)wmemchr(__s, __a, __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 261 | static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 262 | {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);} | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 263 | static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 264 | { | 
|  | 265 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | 
|  | 266 | return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n); | 
|  | 267 | } | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 268 | static inline char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 269 | {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);} | 
|  | 270 |  | 
|  | 271 | static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT | 
|  | 272 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} | 
|  | 273 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT | 
|  | 274 | {return char_type(__c);} | 
|  | 275 | static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT | 
|  | 276 | {return int_type(__c);} | 
|  | 277 | static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT | 
|  | 278 | {return __c1 == __c2;} | 
|  | 279 | static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT | 
|  | 280 | {return int_type(WEOF);} | 
|  | 281 | }; | 
|  | 282 |  | 
|  | 283 | #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS | 
|  | 284 |  | 
|  | 285 | template <> | 
|  | 286 | struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t> | 
|  | 287 | { | 
|  | 288 | typedef char16_t       char_type; | 
|  | 289 | typedef uint_least16_t int_type; | 
|  | 290 | typedef streamoff      off_type; | 
|  | 291 | typedef u16streampos   pos_type; | 
|  | 292 | typedef mbstate_t      state_type; | 
|  | 293 |  | 
|  | 294 | static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT | 
|  | 295 | {__c1 = __c2;} | 
|  | 296 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 297 | {return __c1 == __c2;} | 
|  | 298 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 299 | {return __c1 < __c2;} | 
|  | 300 |  | 
|  | 301 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 302 | static int              compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 303 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 304 | static size_t           length(const char_type* __s) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 305 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 306 | static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 307 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 308 | static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 309 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 310 | static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 311 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 312 | static char_type*       assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 313 |  | 
|  | 314 | static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT | 
|  | 315 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} | 
|  | 316 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT | 
|  | 317 | {return char_type(__c);} | 
|  | 318 | static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT | 
|  | 319 | {return int_type(__c);} | 
|  | 320 | static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT | 
|  | 321 | {return __c1 == __c2;} | 
|  | 322 | static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT | 
|  | 323 | {return int_type(0xFFFF);} | 
|  | 324 | }; | 
|  | 325 |  | 
|  | 326 | inline | 
|  | 327 | int | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 328 | char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 329 | { | 
|  | 330 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 331 | { | 
|  | 332 | if (lt(*__s1, *__s2)) | 
|  | 333 | return -1; | 
|  | 334 | if (lt(*__s2, *__s1)) | 
|  | 335 | return 1; | 
|  | 336 | } | 
|  | 337 | return 0; | 
|  | 338 | } | 
|  | 339 |  | 
|  | 340 | inline | 
|  | 341 | size_t | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 342 | char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 343 | { | 
|  | 344 | size_t __len = 0; | 
|  | 345 | for (; !eq(*__s, char_type(0)); ++__s) | 
|  | 346 | ++__len; | 
|  | 347 | return __len; | 
|  | 348 | } | 
|  | 349 |  | 
|  | 350 | inline | 
|  | 351 | const char16_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 352 | char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 353 | { | 
|  | 354 | for (; __n; --__n) | 
|  | 355 | { | 
|  | 356 | if (eq(*__s, __a)) | 
|  | 357 | return __s; | 
|  | 358 | ++__s; | 
|  | 359 | } | 
|  | 360 | return 0; | 
|  | 361 | } | 
|  | 362 |  | 
|  | 363 | inline | 
|  | 364 | char16_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 365 | char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 366 | { | 
|  | 367 | char_type* __r = __s1; | 
|  | 368 | if (__s1 < __s2) | 
|  | 369 | { | 
|  | 370 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 371 | assign(*__s1, *__s2); | 
|  | 372 | } | 
|  | 373 | else if (__s2 < __s1) | 
|  | 374 | { | 
|  | 375 | __s1 += __n; | 
|  | 376 | __s2 += __n; | 
|  | 377 | for (; __n; --__n) | 
|  | 378 | assign(*--__s1, *--__s2); | 
|  | 379 | } | 
|  | 380 | return __r; | 
|  | 381 | } | 
|  | 382 |  | 
|  | 383 | inline | 
|  | 384 | char16_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 385 | char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 386 | { | 
|  | 387 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | 
|  | 388 | char_type* __r = __s1; | 
|  | 389 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 390 | assign(*__s1, *__s2); | 
|  | 391 | return __r; | 
|  | 392 | } | 
|  | 393 |  | 
|  | 394 | inline | 
|  | 395 | char16_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 396 | char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 397 | { | 
|  | 398 | char_type* __r = __s; | 
|  | 399 | for (; __n; --__n, ++__s) | 
|  | 400 | assign(*__s, __a); | 
|  | 401 | return __r; | 
|  | 402 | } | 
|  | 403 |  | 
|  | 404 | template <> | 
|  | 405 | struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t> | 
|  | 406 | { | 
|  | 407 | typedef char32_t       char_type; | 
|  | 408 | typedef uint_least32_t int_type; | 
|  | 409 | typedef streamoff      off_type; | 
|  | 410 | typedef u32streampos   pos_type; | 
|  | 411 | typedef mbstate_t      state_type; | 
|  | 412 |  | 
|  | 413 | static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT | 
|  | 414 | {__c1 = __c2;} | 
|  | 415 | static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 416 | {return __c1 == __c2;} | 
|  | 417 | static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT | 
|  | 418 | {return __c1 < __c2;} | 
|  | 419 |  | 
|  | 420 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 421 | static int              compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 422 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 423 | static size_t           length(const char_type* __s) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 424 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 425 | static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 426 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 427 | static char_type*       move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 428 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 429 | static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 430 | _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 431 | static char_type*       assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 432 |  | 
|  | 433 | static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT | 
|  | 434 | {return eq_int_type(__c, eof()) ? ~eof() : __c;} | 
|  | 435 | static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT | 
|  | 436 | {return char_type(__c);} | 
|  | 437 | static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT | 
|  | 438 | {return int_type(__c);} | 
|  | 439 | static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT | 
|  | 440 | {return __c1 == __c2;} | 
|  | 441 | static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT | 
|  | 442 | {return int_type(0xFFFFFFFF);} | 
|  | 443 | }; | 
|  | 444 |  | 
|  | 445 | inline | 
|  | 446 | int | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 447 | char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 448 | { | 
|  | 449 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 450 | { | 
|  | 451 | if (lt(*__s1, *__s2)) | 
|  | 452 | return -1; | 
|  | 453 | if (lt(*__s2, *__s1)) | 
|  | 454 | return 1; | 
|  | 455 | } | 
|  | 456 | return 0; | 
|  | 457 | } | 
|  | 458 |  | 
|  | 459 | inline | 
|  | 460 | size_t | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 461 | char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 462 | { | 
|  | 463 | size_t __len = 0; | 
|  | 464 | for (; !eq(*__s, char_type(0)); ++__s) | 
|  | 465 | ++__len; | 
|  | 466 | return __len; | 
|  | 467 | } | 
|  | 468 |  | 
|  | 469 | inline | 
|  | 470 | const char32_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 471 | char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 472 | { | 
|  | 473 | for (; __n; --__n) | 
|  | 474 | { | 
|  | 475 | if (eq(*__s, __a)) | 
|  | 476 | return __s; | 
|  | 477 | ++__s; | 
|  | 478 | } | 
|  | 479 | return 0; | 
|  | 480 | } | 
|  | 481 |  | 
|  | 482 | inline | 
|  | 483 | char32_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 484 | char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 485 | { | 
|  | 486 | char_type* __r = __s1; | 
|  | 487 | if (__s1 < __s2) | 
|  | 488 | { | 
|  | 489 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 490 | assign(*__s1, *__s2); | 
|  | 491 | } | 
|  | 492 | else if (__s2 < __s1) | 
|  | 493 | { | 
|  | 494 | __s1 += __n; | 
|  | 495 | __s2 += __n; | 
|  | 496 | for (; __n; --__n) | 
|  | 497 | assign(*--__s1, *--__s2); | 
|  | 498 | } | 
|  | 499 | return __r; | 
|  | 500 | } | 
|  | 501 |  | 
|  | 502 | inline | 
|  | 503 | char32_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 504 | char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 505 | { | 
|  | 506 | _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); | 
|  | 507 | char_type* __r = __s1; | 
|  | 508 | for (; __n; --__n, ++__s1, ++__s2) | 
|  | 509 | assign(*__s1, *__s2); | 
|  | 510 | return __r; | 
|  | 511 | } | 
|  | 512 |  | 
|  | 513 | inline | 
|  | 514 | char32_t* | 
| Marshall Clow | aa849bc | 2016-07-28 04:52:02 +0000 | [diff] [blame^] | 515 | char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT | 
| Marshall Clow | 053d81c | 2016-07-21 05:31:24 +0000 | [diff] [blame] | 516 | { | 
|  | 517 | char_type* __r = __s; | 
|  | 518 | for (; __n; --__n, ++__s) | 
|  | 519 | assign(*__s, __a); | 
|  | 520 | return __r; | 
|  | 521 | } | 
|  | 522 |  | 
|  | 523 | #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS | 
|  | 524 |  | 
|  | 525 | // helper fns for basic_string and string_view | 
|  | 526 |  | 
|  | 527 | // __str_find | 
|  | 528 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 529 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 530 | __str_find(const _CharT *__p, _SizeT __sz, | 
|  | 531 | _CharT __c, _SizeT __pos) _NOEXCEPT | 
|  | 532 | { | 
|  | 533 | if (__pos >= __sz) | 
|  | 534 | return __npos; | 
|  | 535 | const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); | 
|  | 536 | if (__r == 0) | 
|  | 537 | return __npos; | 
|  | 538 | return static_cast<_SizeT>(__r - __p); | 
|  | 539 | } | 
|  | 540 |  | 
|  | 541 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 542 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 543 | __str_find(const _CharT *__p, _SizeT __sz, | 
|  | 544 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 545 | { | 
|  | 546 | if (__pos > __sz || __sz - __pos < __n) | 
|  | 547 | return __npos; | 
|  | 548 | if (__n == 0) | 
|  | 549 | return __pos; | 
|  | 550 | const _CharT* __r = | 
|  | 551 | _VSTD::__search(__p + __pos, __p + __sz, | 
|  | 552 | __s, __s + __n, _Traits::eq, | 
|  | 553 | random_access_iterator_tag(), random_access_iterator_tag()).first; | 
|  | 554 | if (__r == __p + __sz) | 
|  | 555 | return __npos; | 
|  | 556 | return static_cast<_SizeT>(__r - __p); | 
|  | 557 | } | 
|  | 558 |  | 
|  | 559 |  | 
|  | 560 | // __str_rfind | 
|  | 561 |  | 
|  | 562 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 563 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 564 | __str_rfind(const _CharT *__p, _SizeT __sz, | 
|  | 565 | _CharT __c, _SizeT __pos) _NOEXCEPT | 
|  | 566 | { | 
|  | 567 | if (__sz < 1) | 
|  | 568 | return __npos; | 
|  | 569 | if (__pos < __sz) | 
|  | 570 | ++__pos; | 
|  | 571 | else | 
|  | 572 | __pos = __sz; | 
|  | 573 | for (const _CharT* __ps = __p + __pos; __ps != __p;) | 
|  | 574 | { | 
|  | 575 | if (_Traits::eq(*--__ps, __c)) | 
|  | 576 | return static_cast<_SizeT>(__ps - __p); | 
|  | 577 | } | 
|  | 578 | return __npos; | 
|  | 579 | } | 
|  | 580 |  | 
|  | 581 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 582 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 583 | __str_rfind(const _CharT *__p, _SizeT __sz, | 
|  | 584 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 585 | { | 
|  | 586 | __pos = _VSTD::min(__pos, __sz); | 
|  | 587 | if (__n < __sz - __pos) | 
|  | 588 | __pos += __n; | 
|  | 589 | else | 
|  | 590 | __pos = __sz; | 
|  | 591 | const _CharT* __r = _VSTD::__find_end( | 
|  | 592 | __p, __p + __pos, __s, __s + __n, _Traits::eq, | 
|  | 593 | random_access_iterator_tag(), random_access_iterator_tag()); | 
|  | 594 | if (__n > 0 && __r == __p + __pos) | 
|  | 595 | return __npos; | 
|  | 596 | return static_cast<_SizeT>(__r - __p); | 
|  | 597 | } | 
|  | 598 |  | 
|  | 599 | // __str_find_first_of | 
|  | 600 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 601 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 602 | __str_find_first_of(const _CharT *__p, _SizeT __sz, | 
|  | 603 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 604 | { | 
|  | 605 | if (__pos >= __sz || __n == 0) | 
|  | 606 | return __npos; | 
|  | 607 | const _CharT* __r = _VSTD::__find_first_of_ce | 
|  | 608 | (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq ); | 
|  | 609 | if (__r == __p + __sz) | 
|  | 610 | return __npos; | 
|  | 611 | return static_cast<_SizeT>(__r - __p); | 
|  | 612 | } | 
|  | 613 |  | 
|  | 614 |  | 
|  | 615 | // __str_find_last_of | 
|  | 616 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 617 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 618 | __str_find_last_of(const _CharT *__p, _SizeT __sz, | 
|  | 619 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 620 | { | 
|  | 621 | if (__n != 0) | 
|  | 622 | { | 
|  | 623 | if (__pos < __sz) | 
|  | 624 | ++__pos; | 
|  | 625 | else | 
|  | 626 | __pos = __sz; | 
|  | 627 | for (const _CharT* __ps = __p + __pos; __ps != __p;) | 
|  | 628 | { | 
|  | 629 | const _CharT* __r = _Traits::find(__s, __n, *--__ps); | 
|  | 630 | if (__r) | 
|  | 631 | return static_cast<_SizeT>(__ps - __p); | 
|  | 632 | } | 
|  | 633 | } | 
|  | 634 | return __npos; | 
|  | 635 | } | 
|  | 636 |  | 
|  | 637 |  | 
|  | 638 | // __str_find_first_not_of | 
|  | 639 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 640 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 641 | __str_find_first_not_of(const _CharT *__p, _SizeT __sz, | 
|  | 642 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 643 | { | 
|  | 644 | if (__pos < __sz) | 
|  | 645 | { | 
|  | 646 | const _CharT* __pe = __p + __sz; | 
|  | 647 | for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) | 
|  | 648 | if (_Traits::find(__s, __n, *__ps) == 0) | 
|  | 649 | return static_cast<_SizeT>(__ps - __p); | 
|  | 650 | } | 
|  | 651 | return __npos; | 
|  | 652 | } | 
|  | 653 |  | 
|  | 654 |  | 
|  | 655 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 656 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 657 | __str_find_first_not_of(const _CharT *__p, _SizeT __sz, | 
|  | 658 | _CharT __c, _SizeT __pos) _NOEXCEPT | 
|  | 659 | { | 
|  | 660 | if (__pos < __sz) | 
|  | 661 | { | 
|  | 662 | const _CharT* __pe = __p + __sz; | 
|  | 663 | for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) | 
|  | 664 | if (!_Traits::eq(*__ps, __c)) | 
|  | 665 | return static_cast<_SizeT>(__ps - __p); | 
|  | 666 | } | 
|  | 667 | return __npos; | 
|  | 668 | } | 
|  | 669 |  | 
|  | 670 |  | 
|  | 671 | // __str_find_last_not_of | 
|  | 672 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 673 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 674 | __str_find_last_not_of(const _CharT *__p, _SizeT __sz, | 
|  | 675 | const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT | 
|  | 676 | { | 
|  | 677 | if (__pos < __sz) | 
|  | 678 | ++__pos; | 
|  | 679 | else | 
|  | 680 | __pos = __sz; | 
|  | 681 | for (const _CharT* __ps = __p + __pos; __ps != __p;) | 
|  | 682 | if (_Traits::find(__s, __n, *--__ps) == 0) | 
|  | 683 | return static_cast<_SizeT>(__ps - __p); | 
|  | 684 | return __npos; | 
|  | 685 | } | 
|  | 686 |  | 
|  | 687 |  | 
|  | 688 | template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> | 
|  | 689 | inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY | 
|  | 690 | __str_find_last_not_of(const _CharT *__p, _SizeT __sz, | 
|  | 691 | _CharT __c, _SizeT __pos) _NOEXCEPT | 
|  | 692 | { | 
|  | 693 | if (__pos < __sz) | 
|  | 694 | ++__pos; | 
|  | 695 | else | 
|  | 696 | __pos = __sz; | 
|  | 697 | for (const _CharT* __ps = __p + __pos; __ps != __p;) | 
|  | 698 | if (!_Traits::eq(*--__ps, __c)) | 
|  | 699 | return static_cast<_SizeT>(__ps - __p); | 
|  | 700 | return __npos; | 
|  | 701 | } | 
|  | 702 |  | 
|  | 703 | template<class _Ptr> | 
|  | 704 | size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e) | 
|  | 705 | { | 
|  | 706 | typedef typename iterator_traits<_Ptr>::value_type value_type; | 
|  | 707 | return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type)); | 
|  | 708 | } | 
|  | 709 |  | 
|  | 710 | template <class _CharT, class _Iter, class _Traits=char_traits<_CharT> > | 
|  | 711 | struct __quoted_output_proxy | 
|  | 712 | { | 
|  | 713 | _Iter  __first; | 
|  | 714 | _Iter  __last; | 
|  | 715 | _CharT  __delim; | 
|  | 716 | _CharT  __escape; | 
|  | 717 |  | 
|  | 718 | __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) | 
|  | 719 | : __first(__f), __last(__l), __delim(__d), __escape(__e) {} | 
|  | 720 | //  This would be a nice place for a string_ref | 
|  | 721 | }; | 
|  | 722 |  | 
|  | 723 | _LIBCPP_END_NAMESPACE_STD | 
|  | 724 |  | 
|  | 725 | #endif  // _LIBCPP___STRING |