Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/libcxx/include/string
Line
Count
Source (jump to first uncovered line)
1
// -*- C++ -*-
2
//===--------------------------- string -----------------------------------===//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef _LIBCPP_STRING
11
#define _LIBCPP_STRING
12
13
/*
14
    string synopsis
15
16
namespace std
17
{
18
19
template <class stateT>
20
class fpos
21
{
22
private:
23
    stateT st;
24
public:
25
    fpos(streamoff = streamoff());
26
27
    operator streamoff() const;
28
29
    stateT state() const;
30
    void state(stateT);
31
32
    fpos& operator+=(streamoff);
33
    fpos  operator+ (streamoff) const;
34
    fpos& operator-=(streamoff);
35
    fpos  operator- (streamoff) const;
36
};
37
38
template <class stateT> streamoff operator-(const fpos<stateT>& x, const fpos<stateT>& y);
39
40
template <class stateT> bool operator==(const fpos<stateT>& x, const fpos<stateT>& y);
41
template <class stateT> bool operator!=(const fpos<stateT>& x, const fpos<stateT>& y);
42
43
template <class charT>
44
struct char_traits
45
{
46
    typedef charT     char_type;
47
    typedef ...       int_type;
48
    typedef streamoff off_type;
49
    typedef streampos pos_type;
50
    typedef mbstate_t state_type;
51
52
    static void assign(char_type& c1, const char_type& c2) noexcept;
53
    static constexpr bool eq(char_type c1, char_type c2) noexcept;
54
    static constexpr bool lt(char_type c1, char_type c2) noexcept;
55
56
    static int              compare(const char_type* s1, const char_type* s2, size_t n);
57
    static size_t           length(const char_type* s);
58
    static const char_type* find(const char_type* s, size_t n, const char_type& a);
59
    static char_type*       move(char_type* s1, const char_type* s2, size_t n);
60
    static char_type*       copy(char_type* s1, const char_type* s2, size_t n);
61
    static char_type*       assign(char_type* s, size_t n, char_type a);
62
63
    static constexpr int_type  not_eof(int_type c) noexcept;
64
    static constexpr char_type to_char_type(int_type c) noexcept;
65
    static constexpr int_type  to_int_type(char_type c) noexcept;
66
    static constexpr bool      eq_int_type(int_type c1, int_type c2) noexcept;
67
    static constexpr int_type  eof() noexcept;
68
};
69
70
template <> struct char_traits<char>;
71
template <> struct char_traits<wchar_t>;
72
73
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
74
class basic_string
75
{
76
public:
77
// types:
78
    typedef traits traits_type;
79
    typedef typename traits_type::char_type value_type;
80
    typedef Allocator allocator_type;
81
    typedef typename allocator_type::size_type size_type;
82
    typedef typename allocator_type::difference_type difference_type;
83
    typedef typename allocator_type::reference reference;
84
    typedef typename allocator_type::const_reference const_reference;
85
    typedef typename allocator_type::pointer pointer;
86
    typedef typename allocator_type::const_pointer const_pointer;
87
    typedef implementation-defined iterator;
88
    typedef implementation-defined const_iterator;
89
    typedef std::reverse_iterator<iterator> reverse_iterator;
90
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
91
92
    static const size_type npos = -1;
93
94
    basic_string()
95
        noexcept(is_nothrow_default_constructible<allocator_type>::value);
96
    explicit basic_string(const allocator_type& a);
97
    basic_string(const basic_string& str);
98
    basic_string(basic_string&& str)
99
        noexcept(is_nothrow_move_constructible<allocator_type>::value);
100
    basic_string(const basic_string& str, size_type pos,
101
                 const allocator_type& a = allocator_type());
102
    basic_string(const basic_string& str, size_type pos, size_type n,
103
                 const Allocator& a = Allocator());
104
    template<class T>
105
        basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17
106
    template <class T>
107
        explicit basic_string(const T& t, const Allocator& a = Allocator()); // C++17
108
    basic_string(const value_type* s, const allocator_type& a = allocator_type());
109
    basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
110
    basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
111
    template<class InputIterator>
112
        basic_string(InputIterator begin, InputIterator end,
113
                     const allocator_type& a = allocator_type());
114
    basic_string(initializer_list<value_type>, const Allocator& = Allocator());
115
    basic_string(const basic_string&, const Allocator&);
116
    basic_string(basic_string&&, const Allocator&);
117
118
    ~basic_string();
119
120
    operator basic_string_view<charT, traits>() const noexcept;
121
122
    basic_string& operator=(const basic_string& str);
123
    template <class T>
124
        basic_string& operator=(const T& t); // C++17
125
    basic_string& operator=(basic_string&& str)
126
        noexcept(
127
             allocator_type::propagate_on_container_move_assignment::value ||
128
             allocator_type::is_always_equal::value ); // C++17
129
    basic_string& operator=(const value_type* s);
130
    basic_string& operator=(value_type c);
131
    basic_string& operator=(initializer_list<value_type>);
132
133
    iterator       begin() noexcept;
134
    const_iterator begin() const noexcept;
135
    iterator       end() noexcept;
136
    const_iterator end() const noexcept;
137
138
    reverse_iterator       rbegin() noexcept;
139
    const_reverse_iterator rbegin() const noexcept;
140
    reverse_iterator       rend() noexcept;
141
    const_reverse_iterator rend() const noexcept;
142
143
    const_iterator         cbegin() const noexcept;
144
    const_iterator         cend() const noexcept;
145
    const_reverse_iterator crbegin() const noexcept;
146
    const_reverse_iterator crend() const noexcept;
147
148
    size_type size() const noexcept;
149
    size_type length() const noexcept;
150
    size_type max_size() const noexcept;
151
    size_type capacity() const noexcept;
152
153
    void resize(size_type n, value_type c);
154
    void resize(size_type n);
155
156
    void reserve(size_type res_arg = 0);
157
    void shrink_to_fit();
158
    void clear() noexcept;
159
    bool empty() const noexcept;
160
161
    const_reference operator[](size_type pos) const;
162
    reference       operator[](size_type pos);
163
164
    const_reference at(size_type n) const;
165
    reference       at(size_type n);
166
167
    basic_string& operator+=(const basic_string& str);
168
    template <class T>
169
        basic_string& operator+=(const T& t);              // C++17
170
    basic_string& operator+=(const value_type* s);
171
    basic_string& operator+=(value_type c);
172
    basic_string& operator+=(initializer_list<value_type>);
173
174
    basic_string& append(const basic_string& str);
175
    template <class T>
176
        basic_string& append(const T& t);                 // C++17
177
    basic_string& append(const basic_string& str, size_type pos, size_type n=npos); //C++14
178
    template <class T>
179
        basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
180
    basic_string& append(const value_type* s, size_type n);
181
    basic_string& append(const value_type* s);
182
    basic_string& append(size_type n, value_type c);
183
    template<class InputIterator>
184
        basic_string& append(InputIterator first, InputIterator last);
185
    basic_string& append(initializer_list<value_type>);
186
187
    void push_back(value_type c);
188
    void pop_back();
189
    reference       front();
190
    const_reference front() const;
191
    reference       back();
192
    const_reference back() const;
193
194
    basic_string& assign(const basic_string& str);
195
    template <class T>
196
        basic_string& assign(const T& t);  // C++17
197
    basic_string& assign(basic_string&& str);
198
    basic_string& assign(const basic_string& str, size_type pos, size_type n=npos); // C++14
199
    template <class T>
200
        basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17
201
    basic_string& assign(const value_type* s, size_type n);
202
    basic_string& assign(const value_type* s);
203
    basic_string& assign(size_type n, value_type c);
204
    template<class InputIterator>
205
        basic_string& assign(InputIterator first, InputIterator last);
206
    basic_string& assign(initializer_list<value_type>);
207
208
    basic_string& insert(size_type pos1, const basic_string& str);
209
    template <class T>
210
        basic_string& insert(size_type pos1, const T& t);
211
    basic_string& insert(size_type pos1, const basic_string& str,
212
                         size_type pos2, size_type n);
213
    template <class T>
214
        basic_string& insert(size_type pos1, const T& t, size_type pos2, size_type n); // C++17
215
    basic_string& insert(size_type pos, const value_type* s, size_type n=npos); //C++14
216
    basic_string& insert(size_type pos, const value_type* s);
217
    basic_string& insert(size_type pos, size_type n, value_type c);
218
    iterator      insert(const_iterator p, value_type c);
219
    iterator      insert(const_iterator p, size_type n, value_type c);
220
    template<class InputIterator>
221
        iterator insert(const_iterator p, InputIterator first, InputIterator last);
222
    iterator      insert(const_iterator p, initializer_list<value_type>);
223
224
    basic_string& erase(size_type pos = 0, size_type n = npos);
225
    iterator      erase(const_iterator position);
226
    iterator      erase(const_iterator first, const_iterator last);
227
228
    basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
229
    template <class T>
230
    basic_string& replace(size_type pos1, size_type n1, const T& t);  // C++17
231
    basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
232
                          size_type pos2, size_type n2=npos); // C++14
233
    template <class T>
234
        basic_string& replace(size_type pos1, size_type n1, const T& t,
235
                              size_type pos2, size_type n); // C++17
236
    basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
237
    basic_string& replace(size_type pos, size_type n1, const value_type* s);
238
    basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
239
    basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
240
    template <class T>
241
        basic_string& replace(const_iterator i1, const_iterator i2, const T& t);  // C++17
242
    basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
243
    basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
244
    basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
245
    template<class InputIterator>
246
        basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
247
    basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
248
249
    size_type copy(value_type* s, size_type n, size_type pos = 0) const;
250
    basic_string substr(size_type pos = 0, size_type n = npos) const;
251
252
    void swap(basic_string& str)
253
        noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
254
                 allocator_traits<allocator_type>::is_always_equal::value);  // C++17
255
256
    const value_type* c_str() const noexcept;
257
    const value_type* data() const noexcept;
258
          value_type* data()       noexcept;   // C++17
259
260
    allocator_type get_allocator() const noexcept;
261
262
    size_type find(const basic_string& str, size_type pos = 0) const noexcept;
263
    template <class T>
264
        size_type find(const T& t, size_type pos = 0) const;  // C++17
265
    size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
266
    size_type find(const value_type* s, size_type pos = 0) const noexcept;
267
    size_type find(value_type c, size_type pos = 0) const noexcept;
268
269
    size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
270
    template <class T>
271
        size_type rfind(const T& t, size_type pos = npos) const;  // C++17
272
    size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
273
    size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
274
    size_type rfind(value_type c, size_type pos = npos) const noexcept;
275
276
    size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
277
    template <class T>
278
        size_type find_first_of(const T& t, size_type pos = 0) const; // C++17
279
    size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
280
    size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
281
    size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
282
283
    size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
284
    template <class T>
285
        size_type find_last_of(const T& t, size_type pos = npos) const noexcept;  // C++17
286
    size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
287
    size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
288
    size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
289
290
    size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
291
    template <class T>
292
        size_type find_first_not_of(const T& t, size_type pos = 0) const; // C++17
293
    size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
294
    size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
295
    size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
296
297
    size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
298
    template <class T>
299
        size_type find_last_not_of(const T& t, size_type pos = npos) const; // C++17
300
    size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
301
    size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
302
    size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
303
304
    int compare(const basic_string& str) const noexcept;
305
    template <class T>
306
        int compare(const T& t) const noexcept;  // C++17
307
    int compare(size_type pos1, size_type n1, const basic_string& str) const;
308
    template <class T>
309
        int compare(size_type pos1, size_type n1, const T& t) const;  // C++17
310
    int compare(size_type pos1, size_type n1, const basic_string& str,
311
                size_type pos2, size_type n2=npos) const; // C++14
312
    template <class T>
313
        int compare(size_type pos1, size_type n1, const T& t,
314
                    size_type pos2, size_type n2=npos) const; // C++17
315
    int compare(const value_type* s) const noexcept;
316
    int compare(size_type pos1, size_type n1, const value_type* s) const;
317
    int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
318
319
    bool starts_with(basic_string_view<charT, traits> sv) const noexcept; // C++2a
320
    bool starts_with(charT c) const noexcept;                             // C++2a
321
    bool starts_with(const charT* s) const;                               // C++2a
322
    bool ends_with(basic_string_view<charT, traits> sv) const noexcept;   // C++2a
323
    bool ends_with(charT c) const noexcept;                               // C++2a
324
    bool ends_with(const charT* s) const;                                 // C++2a
325
326
    bool __invariants() const;
327
};
328
329
template<class InputIterator,
330
         class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
331
basic_string(InputIterator, InputIterator, Allocator = Allocator())
332
   -> basic_string<typename iterator_traits<InputIterator>::value_type,
333
                  char_traits<typename iterator_traits<InputIterator>::value_type>,
334
                  Allocator>;   // C++17
335
336
template<class charT, class traits, class Allocator>
337
basic_string<charT, traits, Allocator>
338
operator+(const basic_string<charT, traits, Allocator>& lhs,
339
          const basic_string<charT, traits, Allocator>& rhs);
340
341
template<class charT, class traits, class Allocator>
342
basic_string<charT, traits, Allocator>
343
operator+(const charT* lhs , const basic_string<charT,traits,Allocator>&rhs);
344
345
template<class charT, class traits, class Allocator>
346
basic_string<charT, traits, Allocator>
347
operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
348
349
template<class charT, class traits, class Allocator>
350
basic_string<charT, traits, Allocator>
351
operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs);
352
353
template<class charT, class traits, class Allocator>
354
basic_string<charT, traits, Allocator>
355
operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
356
357
template<class charT, class traits, class Allocator>
358
bool operator==(const basic_string<charT, traits, Allocator>& lhs,
359
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
360
361
template<class charT, class traits, class Allocator>
362
bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
363
364
template<class charT, class traits, class Allocator>
365
bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept;
366
367
template<class charT, class traits, class Allocator>
368
bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
369
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
370
371
template<class charT, class traits, class Allocator>
372
bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
373
374
template<class charT, class traits, class Allocator>
375
bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
376
377
template<class charT, class traits, class Allocator>
378
bool operator< (const basic_string<charT, traits, Allocator>& lhs,
379
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
380
381
template<class charT, class traits, class Allocator>
382
bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
383
384
template<class charT, class traits, class Allocator>
385
bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
386
387
template<class charT, class traits, class Allocator>
388
bool operator> (const basic_string<charT, traits, Allocator>& lhs,
389
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
390
391
template<class charT, class traits, class Allocator>
392
bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
393
394
template<class charT, class traits, class Allocator>
395
bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
396
397
template<class charT, class traits, class Allocator>
398
bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
399
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
400
401
template<class charT, class traits, class Allocator>
402
bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
403
404
template<class charT, class traits, class Allocator>
405
bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
406
407
template<class charT, class traits, class Allocator>
408
bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
409
                const basic_string<charT, traits, Allocator>& rhs) noexcept;
410
411
template<class charT, class traits, class Allocator>
412
bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
413
414
template<class charT, class traits, class Allocator>
415
bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
416
417
template<class charT, class traits, class Allocator>
418
void swap(basic_string<charT, traits, Allocator>& lhs,
419
          basic_string<charT, traits, Allocator>& rhs)
420
            noexcept(noexcept(lhs.swap(rhs)));
421
422
template<class charT, class traits, class Allocator>
423
basic_istream<charT, traits>&
424
operator>>(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
425
426
template<class charT, class traits, class Allocator>
427
basic_ostream<charT, traits>&
428
operator<<(basic_ostream<charT, traits>& os, const basic_string<charT, traits, Allocator>& str);
429
430
template<class charT, class traits, class Allocator>
431
basic_istream<charT, traits>&
432
getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str,
433
        charT delim);
434
435
template<class charT, class traits, class Allocator>
436
basic_istream<charT, traits>&
437
getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
438
439
template<class charT, class traits, class Allocator, class U>
440
void erase(basic_string<charT, traits, Allocator>& c, const U& value); // C++20
441
template<class charT, class traits, class Allocator, class Predicate>
442
void erase_if(basic_string<charT, traits, Allocator>& c, Predicate pred); // C++20
443
444
typedef basic_string<char>    string;
445
typedef basic_string<wchar_t> wstring;
446
typedef basic_string<char16_t> u16string;
447
typedef basic_string<char32_t> u32string;
448
449
int                stoi  (const string& str, size_t* idx = 0, int base = 10);
450
long               stol  (const string& str, size_t* idx = 0, int base = 10);
451
unsigned long      stoul (const string& str, size_t* idx = 0, int base = 10);
452
long long          stoll (const string& str, size_t* idx = 0, int base = 10);
453
unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
454
455
float       stof (const string& str, size_t* idx = 0);
456
double      stod (const string& str, size_t* idx = 0);
457
long double stold(const string& str, size_t* idx = 0);
458
459
string to_string(int val);
460
string to_string(unsigned val);
461
string to_string(long val);
462
string to_string(unsigned long val);
463
string to_string(long long val);
464
string to_string(unsigned long long val);
465
string to_string(float val);
466
string to_string(double val);
467
string to_string(long double val);
468
469
int                stoi  (const wstring& str, size_t* idx = 0, int base = 10);
470
long               stol  (const wstring& str, size_t* idx = 0, int base = 10);
471
unsigned long      stoul (const wstring& str, size_t* idx = 0, int base = 10);
472
long long          stoll (const wstring& str, size_t* idx = 0, int base = 10);
473
unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
474
475
float       stof (const wstring& str, size_t* idx = 0);
476
double      stod (const wstring& str, size_t* idx = 0);
477
long double stold(const wstring& str, size_t* idx = 0);
478
479
wstring to_wstring(int val);
480
wstring to_wstring(unsigned val);
481
wstring to_wstring(long val);
482
wstring to_wstring(unsigned long val);
483
wstring to_wstring(long long val);
484
wstring to_wstring(unsigned long long val);
485
wstring to_wstring(float val);
486
wstring to_wstring(double val);
487
wstring to_wstring(long double val);
488
489
template <> struct hash<string>;
490
template <> struct hash<u16string>;
491
template <> struct hash<u32string>;
492
template <> struct hash<wstring>;
493
494
basic_string<char>     operator "" s( const char *str,     size_t len ); // C++14
495
basic_string<wchar_t>  operator "" s( const wchar_t *str,  size_t len ); // C++14
496
basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++14
497
basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++14
498
499
}  // std
500
501
*/
502
503
#include <__config>
504
#include <string_view>
505
#include <iosfwd>
506
#include <cstring>
507
#include <cstdio>  // For EOF.
508
#include <cwchar>
509
#include <algorithm>
510
#include <iterator>
511
#include <utility>
512
#include <memory>
513
#include <stdexcept>
514
#include <type_traits>
515
#include <initializer_list>
516
#include <__functional_base>
517
#include <version>
518
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
519
#include <cstdint>
520
#endif
521
522
#include <__debug>
523
524
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
525
#pragma GCC system_header
526
#endif
527
528
_LIBCPP_PUSH_MACROS
529
#include <__undef_macros>
530
531
532
_LIBCPP_BEGIN_NAMESPACE_STD
533
534
// fpos
535
536
template <class _StateT>
537
class _LIBCPP_TEMPLATE_VIS fpos
538
{
539
private:
540
    _StateT __st_;
541
    streamoff __off_;
542
public:
543
0
    _LIBCPP_INLINE_VISIBILITY fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {}
544
545
0
    _LIBCPP_INLINE_VISIBILITY operator streamoff() const {return __off_;}
546
547
0
    _LIBCPP_INLINE_VISIBILITY _StateT state() const {return __st_;}
548
0
    _LIBCPP_INLINE_VISIBILITY void state(_StateT __st) {__st_ = __st;}
549
550
    _LIBCPP_INLINE_VISIBILITY fpos& operator+=(streamoff __off) {__off_ += __off; return *this;}
551
    _LIBCPP_INLINE_VISIBILITY fpos  operator+ (streamoff __off) const {fpos __t(*this); __t += __off; return __t;}
552
    _LIBCPP_INLINE_VISIBILITY fpos& operator-=(streamoff __off) {__off_ -= __off; return *this;}
553
    _LIBCPP_INLINE_VISIBILITY fpos  operator- (streamoff __off) const {fpos __t(*this); __t -= __off; return __t;}
554
};
555
556
template <class _StateT>
557
inline _LIBCPP_INLINE_VISIBILITY
558
streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
559
    {return streamoff(__x) - streamoff(__y);}
560
561
template <class _StateT>
562
inline _LIBCPP_INLINE_VISIBILITY
563
bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
564
0
    {return streamoff(__x) == streamoff(__y);}
565
566
template <class _StateT>
567
inline _LIBCPP_INLINE_VISIBILITY
568
bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
569
    {return streamoff(__x) != streamoff(__y);}
570
571
// basic_string
572
573
template<class _CharT, class _Traits, class _Allocator>
574
basic_string<_CharT, _Traits, _Allocator>
575
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
576
          const basic_string<_CharT, _Traits, _Allocator>& __y);
577
578
template<class _CharT, class _Traits, class _Allocator>
579
basic_string<_CharT, _Traits, _Allocator>
580
operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
581
582
template<class _CharT, class _Traits, class _Allocator>
583
basic_string<_CharT, _Traits, _Allocator>
584
operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
585
586
template<class _CharT, class _Traits, class _Allocator>
587
inline _LIBCPP_INLINE_VISIBILITY
588
basic_string<_CharT, _Traits, _Allocator>
589
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
590
591
template<class _CharT, class _Traits, class _Allocator>
592
basic_string<_CharT, _Traits, _Allocator>
593
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
594
595
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
596
597
template <bool>
598
class _LIBCPP_TEMPLATE_VIS __basic_string_common
599
{
600
protected:
601
    _LIBCPP_NORETURN void __throw_length_error() const;
602
    _LIBCPP_NORETURN void __throw_out_of_range() const;
603
};
604
605
template <bool __b>
606
void
607
__basic_string_common<__b>::__throw_length_error() const
608
0
{
609
0
    _VSTD::__throw_length_error("basic_string");
610
0
}
611
612
template <bool __b>
613
void
614
__basic_string_common<__b>::__throw_out_of_range() const
615
0
{
616
0
    _VSTD::__throw_out_of_range("basic_string");
617
0
}
618
619
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __basic_string_common<true>)
620
621
#ifdef _LIBCPP_NO_EXCEPTIONS
622
template <class _Iter>
623
struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {};
624
#elif defined(_LIBCPP_HAS_NO_NOEXCEPT)
625
template <class _Iter>
626
struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
627
#else
628
template <class _Iter, bool = __is_cpp17_forward_iterator<_Iter>::value>
629
struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
630
    noexcept(++(declval<_Iter&>())) &&
631
    is_nothrow_assignable<_Iter&, _Iter>::value &&
632
    noexcept(declval<_Iter>() == declval<_Iter>()) &&
633
    noexcept(*declval<_Iter>())
634
)) {};
635
636
template <class _Iter>
637
struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};
638
#endif
639
640
641
template <class _Iter>
642
struct __libcpp_string_gets_noexcept_iterator
643
    : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value || __libcpp_string_gets_noexcept_iterator_impl<_Iter>::value) {};
644
645
template <class _CharT, class _Traits, class _Tp>
646
struct __can_be_converted_to_string_view : public _BoolConstant<
647
      is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
648
     !is_convertible<const _Tp&, const _CharT*>::value
649
    > {};
650
651
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
652
653
template <class _CharT, size_t = sizeof(_CharT)>
654
struct __padding
655
{
656
    unsigned char __xx[sizeof(_CharT)-1];
657
};
658
659
template <class _CharT>
660
struct __padding<_CharT, 1>
661
{
662
};
663
664
#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
665
666
template<class _CharT, class _Traits, class _Allocator>
667
class _LIBCPP_TEMPLATE_VIS basic_string
668
    : private __basic_string_common<true>
669
{
670
public:
671
    typedef basic_string                                 __self;
672
    typedef basic_string_view<_CharT, _Traits>           __self_view;
673
    typedef _Traits                                      traits_type;
674
    typedef _CharT                                       value_type;
675
    typedef _Allocator                                   allocator_type;
676
    typedef allocator_traits<allocator_type>             __alloc_traits;
677
    typedef typename __alloc_traits::size_type           size_type;
678
    typedef typename __alloc_traits::difference_type     difference_type;
679
    typedef value_type&                                  reference;
680
    typedef const value_type&                            const_reference;
681
    typedef typename __alloc_traits::pointer             pointer;
682
    typedef typename __alloc_traits::const_pointer       const_pointer;
683
684
    static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
685
    static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
686
    static_assert(( is_trivial<value_type>::value), "Character type of basic_string must be trivial");
687
    static_assert(( is_same<_CharT, typename traits_type::char_type>::value),
688
                  "traits_type::char_type must be the same type as CharT");
689
    static_assert(( is_same<typename allocator_type::value_type, value_type>::value),
690
                  "Allocator::value_type must be same type as value_type");
691
692
#if defined(_LIBCPP_RAW_ITERATORS)
693
    typedef pointer                                      iterator;
694
    typedef const_pointer                                const_iterator;
695
#else  // defined(_LIBCPP_RAW_ITERATORS)
696
    typedef __wrap_iter<pointer>                         iterator;
697
    typedef __wrap_iter<const_pointer>                   const_iterator;
698
#endif  // defined(_LIBCPP_RAW_ITERATORS)
699
    typedef _VSTD::reverse_iterator<iterator>             reverse_iterator;
700
    typedef _VSTD::reverse_iterator<const_iterator>       const_reverse_iterator;
701
702
private:
703
704
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
705
706
    struct __long
707
    {
708
        pointer   __data_;
709
        size_type __size_;
710
        size_type __cap_;
711
    };
712
713
#ifdef _LIBCPP_BIG_ENDIAN
714
    static const size_type __short_mask = 0x01;
715
    static const size_type __long_mask  = 0x1ul;
716
#else  // _LIBCPP_BIG_ENDIAN
717
    static const size_type __short_mask = 0x80;
718
    static const size_type __long_mask  = ~(size_type(~0) >> 1);
719
#endif  // _LIBCPP_BIG_ENDIAN
720
721
    enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
722
                      (sizeof(__long) - 1)/sizeof(value_type) : 2};
723
724
    struct __short
725
    {
726
        value_type __data_[__min_cap];
727
        struct
728
            : __padding<value_type>
729
        {
730
            unsigned char __size_;
731
        };
732
    };
733
734
#else
735
736
    struct __long
737
    {
738
        size_type __cap_;
739
        size_type __size_;
740
        pointer   __data_;
741
    };
742
743
#ifdef _LIBCPP_BIG_ENDIAN
744
    static const size_type __short_mask = 0x80;
745
    static const size_type __long_mask  = ~(size_type(~0) >> 1);
746
#else  // _LIBCPP_BIG_ENDIAN
747
    static const size_type __short_mask = 0x01;
748
    static const size_type __long_mask  = 0x1ul;
749
#endif  // _LIBCPP_BIG_ENDIAN
750
751
    enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
752
                      (sizeof(__long) - 1)/sizeof(value_type) : 2};
753
754
    struct __short
755
    {
756
        union
757
        {
758
            unsigned char __size_;
759
            value_type __lx;
760
        };
761
        value_type __data_[__min_cap];
762
    };
763
764
#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
765
766
    union __ulx{__long __lx; __short __lxx;};
767
768
    enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
769
770
    struct __raw
771
    {
772
        size_type __words[__n_words];
773
    };
774
775
    struct __rep
776
    {
777
        union
778
        {
779
            __long  __l;
780
            __short __s;
781
            __raw   __r;
782
        };
783
    };
784
785
    __compressed_pair<__rep, allocator_type> __r_;
786
787
public:
788
    _LIBCPP_FUNC_VIS
789
    static const size_type npos = -1;
790
791
    _LIBCPP_INLINE_VISIBILITY basic_string()
792
        _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
793
794
    _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
795
#if _LIBCPP_STD_VER <= 14
796
        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
797
#else
798
        _NOEXCEPT;
799
#endif
800
801
    basic_string(const basic_string& __str);
802
    basic_string(const basic_string& __str, const allocator_type& __a);
803
804
#ifndef _LIBCPP_CXX03_LANG
805
    _LIBCPP_INLINE_VISIBILITY
806
    basic_string(basic_string&& __str)
807
#if _LIBCPP_STD_VER <= 14
808
        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
809
#else
810
        _NOEXCEPT;
811
#endif
812
813
    _LIBCPP_INLINE_VISIBILITY
814
    basic_string(basic_string&& __str, const allocator_type& __a);
815
#endif  // _LIBCPP_CXX03_LANG
816
817
    template <class = _EnableIf<__is_allocator<_Allocator>::value, nullptr_t> >
818
    _LIBCPP_INLINE_VISIBILITY
819
385M
    basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
820
385M
      _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
821
385M
      __init(__s, traits_type::length(__s));
822
#   if _LIBCPP_DEBUG_LEVEL >= 2
823
      __get_db()->__insert_c(this);
824
#   endif
825
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*)
Line
Count
Source
819
385M
    basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
820
385M
      _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
821
385M
      __init(__s, traits_type::length(__s));
822
#   if _LIBCPP_DEBUG_LEVEL >= 2
823
      __get_db()->__insert_c(this);
824
#   endif
825
    }
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string<std::nullptr_t>(wchar_t const*)
Line
Count
Source
819
63
    basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
820
63
      _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
821
63
      __init(__s, traits_type::length(__s));
822
#   if _LIBCPP_DEBUG_LEVEL >= 2
823
      __get_db()->__insert_c(this);
824
#   endif
825
    }
826
827
    template <class = _EnableIf<__is_allocator<_Allocator>::value, nullptr_t> >
828
        _LIBCPP_INLINE_VISIBILITY
829
        basic_string(const _CharT* __s, const _Allocator& __a);
830
831
    _LIBCPP_INLINE_VISIBILITY
832
    basic_string(const _CharT* __s, size_type __n);
833
    _LIBCPP_INLINE_VISIBILITY
834
    basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
835
    _LIBCPP_INLINE_VISIBILITY
836
    basic_string(size_type __n, _CharT __c);
837
838
    template <class = _EnableIf<__is_allocator<_Allocator>::value, nullptr_t> >
839
        _LIBCPP_INLINE_VISIBILITY
840
        basic_string(size_type __n, _CharT __c, const _Allocator& __a);
841
842
    basic_string(const basic_string& __str, size_type __pos, size_type __n,
843
                 const _Allocator& __a = _Allocator());
844
    _LIBCPP_INLINE_VISIBILITY
845
    basic_string(const basic_string& __str, size_type __pos,
846
                 const _Allocator& __a = _Allocator());
847
848
    template<class _Tp, class = _EnableIf<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
849
        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
850
        basic_string(const _Tp& __t, size_type __pos, size_type __n,
851
                     const allocator_type& __a = allocator_type());
852
853
    template<class _Tp, class = _EnableIf<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
854
                                          !__is_same_uncvref<_Tp, basic_string>::value> >
855
        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
856
        explicit basic_string(const _Tp& __t);
857
858
    template<class _Tp, class = _EnableIf<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
859
        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
860
        explicit basic_string(const _Tp& __t, const allocator_type& __a);
861
862
    template<class _InputIterator, class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value> >
863
        _LIBCPP_INLINE_VISIBILITY
864
        basic_string(_InputIterator __first, _InputIterator __last);
865
    template<class _InputIterator, class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value> >
866
        _LIBCPP_INLINE_VISIBILITY
867
        basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
868
#ifndef _LIBCPP_CXX03_LANG
869
    _LIBCPP_INLINE_VISIBILITY
870
    basic_string(initializer_list<_CharT> __il);
871
    _LIBCPP_INLINE_VISIBILITY
872
    basic_string(initializer_list<_CharT> __il, const _Allocator& __a);
873
#endif  // _LIBCPP_CXX03_LANG
874
875
    inline ~basic_string();
876
877
    _LIBCPP_INLINE_VISIBILITY
878
317M
    operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator std::__1::basic_string_view<char, std::__1::char_traits<char> >() const
Line
Count
Source
878
317M
    operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator std::__1::basic_string_view<wchar_t, std::__1::char_traits<wchar_t> >() const
879
880
    basic_string& operator=(const basic_string& __str);
881
882
    template <class _Tp, class = _EnableIf<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value> >
883
    basic_string& operator=(const _Tp& __t)
884
        {__self_view __sv = __t; return assign(__sv);}
885
886
#ifndef _LIBCPP_CXX03_LANG
887
    _LIBCPP_INLINE_VISIBILITY
888
    basic_string& operator=(basic_string&& __str)
889
        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
890
     _LIBCPP_INLINE_VISIBILITY
891
    basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
892
#endif
893
26.2M
    _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(char const*)
Line
Count
Source
893
26.2M
    _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator=(wchar_t const*)
Line
Count
Source
893
5
    _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
894
    basic_string& operator=(value_type __c);
895
896
#if _LIBCPP_DEBUG_LEVEL >= 2
897
    _LIBCPP_INLINE_VISIBILITY
898
    iterator begin() _NOEXCEPT
899
        {return iterator(this, __get_pointer());}
900
    _LIBCPP_INLINE_VISIBILITY
901
    const_iterator begin() const _NOEXCEPT
902
        {return const_iterator(this, __get_pointer());}
903
    _LIBCPP_INLINE_VISIBILITY
904
    iterator end() _NOEXCEPT
905
        {return iterator(this, __get_pointer() + size());}
906
    _LIBCPP_INLINE_VISIBILITY
907
    const_iterator end() const _NOEXCEPT
908
        {return const_iterator(this, __get_pointer() + size());}
909
#else
910
    _LIBCPP_INLINE_VISIBILITY
911
    iterator begin() _NOEXCEPT
912
944M
        {return iterator(__get_pointer());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::begin()
Line
Count
Source
912
944M
        {return iterator(__get_pointer());}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::begin()
913
    _LIBCPP_INLINE_VISIBILITY
914
    const_iterator begin() const _NOEXCEPT
915
957k
        {return const_iterator(__get_pointer());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::begin() const
Line
Count
Source
915
957k
        {return const_iterator(__get_pointer());}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::begin() const
Line
Count
Source
915
8
        {return const_iterator(__get_pointer());}
916
    _LIBCPP_INLINE_VISIBILITY
917
    iterator end() _NOEXCEPT
918
2.95M
        {return iterator(__get_pointer() + size());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::end()
Line
Count
Source
918
2.95M
        {return iterator(__get_pointer() + size());}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::end()
919
    _LIBCPP_INLINE_VISIBILITY
920
    const_iterator end() const _NOEXCEPT
921
1.08M
        {return const_iterator(__get_pointer() + size());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::end() const
Line
Count
Source
921
1.08M
        {return const_iterator(__get_pointer() + size());}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::end() const
Line
Count
Source
921
8
        {return const_iterator(__get_pointer() + size());}
922
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
923
    _LIBCPP_INLINE_VISIBILITY
924
    reverse_iterator rbegin() _NOEXCEPT
925
        {return reverse_iterator(end());}
926
    _LIBCPP_INLINE_VISIBILITY
927
    const_reverse_iterator rbegin() const _NOEXCEPT
928
        {return const_reverse_iterator(end());}
929
    _LIBCPP_INLINE_VISIBILITY
930
    reverse_iterator rend() _NOEXCEPT
931
        {return reverse_iterator(begin());}
932
    _LIBCPP_INLINE_VISIBILITY
933
    const_reverse_iterator rend() const _NOEXCEPT
934
        {return const_reverse_iterator(begin());}
935
936
    _LIBCPP_INLINE_VISIBILITY
937
    const_iterator cbegin() const _NOEXCEPT
938
        {return begin();}
939
    _LIBCPP_INLINE_VISIBILITY
940
    const_iterator cend() const _NOEXCEPT
941
        {return end();}
942
    _LIBCPP_INLINE_VISIBILITY
943
    const_reverse_iterator crbegin() const _NOEXCEPT
944
        {return rbegin();}
945
    _LIBCPP_INLINE_VISIBILITY
946
    const_reverse_iterator crend() const _NOEXCEPT
947
        {return rend();}
948
949
    _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT
950
2.41G
        {return __is_long() ? 
__get_long_size()472M
:
__get_short_size()1.93G
;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::size() const
Line
Count
Source
950
2.41G
        {return __is_long() ? 
__get_long_size()472M
:
__get_short_size()1.93G
;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::size() const
Line
Count
Source
950
184
        {return __is_long() ? 
__get_long_size()124
:
__get_short_size()60
;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::size() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::size() const
951
1.20G
    _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
952
    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
953
    _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
954
140M
        {return (__is_long() ? 
__get_long_cap()44.3M
955
140M
                             : 
static_cast<size_type>(__min_cap)96.0M
) - 1;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::capacity() const
Line
Count
Source
954
140M
        {return (__is_long() ? 
__get_long_cap()44.3M
955
140M
                             : 
static_cast<size_type>(__min_cap)96.0M
) - 1;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::capacity() const
Line
Count
Source
954
16
        {return (__is_long() ? 
__get_long_cap()12
955
16
                             : 
static_cast<size_type>(__min_cap)4
) - 1;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::capacity() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::capacity() const
956
957
    void resize(size_type __n, value_type __c);
958
33.3M
    _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long)
Line
Count
Source
958
33.3M
    _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::resize(unsigned long)
Line
Count
Source
958
25
    _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
959
960
    void reserve(size_type __res_arg);
961
    _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n);
962
963
    _LIBCPP_INLINE_VISIBILITY
964
    void reserve() _NOEXCEPT {reserve(0);}
965
    _LIBCPP_INLINE_VISIBILITY
966
    void shrink_to_fit() _NOEXCEPT {reserve();}
967
    _LIBCPP_INLINE_VISIBILITY
968
    void clear() _NOEXCEPT;
969
    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
970
78.2M
    bool empty() const _NOEXCEPT {return size() == 0;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::empty() const
Line
Count
Source
970
78.2M
    bool empty() const _NOEXCEPT {return size() == 0;}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::empty() const
971
972
    _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const _NOEXCEPT;
973
    _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __pos)       _NOEXCEPT;
974
975
    const_reference at(size_type __n) const;
976
    reference       at(size_type __n);
977
978
9.21M
    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
979
980
    template <class _Tp>
981
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
982
    _EnableIf
983
        <
984
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
985
            && !__is_same_uncvref<_Tp, basic_string >::value,
986
            basic_string&
987
        >
988
0
                                            operator+=(const _Tp& __t)            {__self_view __sv = __t; return append(__sv);}
989
1.57M
    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s)     {return append(__s);}
990
238M
    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c)            {push_back(__c); return *this;}
991
#ifndef _LIBCPP_CXX03_LANG
992
    _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
993
#endif  // _LIBCPP_CXX03_LANG
994
995
    _LIBCPP_INLINE_VISIBILITY
996
    basic_string& append(const basic_string& __str);
997
998
    template <class _Tp>
999
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1000
    _EnableIf<
1001
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
1002
            && !__is_same_uncvref<_Tp, basic_string>::value,
1003
            basic_string&
1004
        >
1005
0
                  append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); }
1006
    basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
1007
1008
    template <class _Tp>
1009
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1010
    _EnableIf
1011
        <
1012
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
1013
            && !__is_same_uncvref<_Tp, basic_string>::value,
1014
            basic_string&
1015
        >
1016
                  append(const _Tp& __t, size_type __pos, size_type __n=npos);
1017
    basic_string& append(const value_type* __s, size_type __n);
1018
    basic_string& append(const value_type* __s);
1019
    basic_string& append(size_type __n, value_type __c);
1020
1021
    _LIBCPP_INLINE_VISIBILITY
1022
    void __append_default_init(size_type __n);
1023
1024
    template <class _ForwardIterator>
1025
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1026
    basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
1027
    template<class _InputIterator>
1028
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1029
    _EnableIf
1030
        <
1031
            __is_exactly_cpp17_input_iterator<_InputIterator>::value
1032
                || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1033
            basic_string&
1034
        >
1035
    _LIBCPP_INLINE_VISIBILITY
1036
    append(_InputIterator __first, _InputIterator __last) {
1037
      const basic_string __temp (__first, __last, __alloc());
1038
      append(__temp.data(), __temp.size());
1039
      return *this;
1040
    }
1041
    template<class _ForwardIterator>
1042
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1043
    _EnableIf
1044
        <
1045
            __is_cpp17_forward_iterator<_ForwardIterator>::value
1046
                && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1047
            basic_string&
1048
        >
1049
    _LIBCPP_INLINE_VISIBILITY
1050
0
    append(_ForwardIterator __first, _ForwardIterator __last) {
1051
0
      return __append_forward_unsafe(__first, __last);
1052
0
    }
Unexecuted instantiation: std::__1::_MetaBase<(__is_cpp17_forward_iterator<char*>::value) && (__libcpp_string_gets_noexcept_iterator<char*>::value)>::_EnableIfImpl<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append<char*>(char*, char*)
Unexecuted instantiation: std::__1::_MetaBase<(__is_cpp17_forward_iterator<wchar_t*>::value) && (__libcpp_string_gets_noexcept_iterator<wchar_t*>::value)>::_EnableIfImpl<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&> std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append<wchar_t*>(wchar_t*, wchar_t*)
1053
1054
#ifndef _LIBCPP_CXX03_LANG
1055
    _LIBCPP_INLINE_VISIBILITY
1056
    basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
1057
#endif  // _LIBCPP_CXX03_LANG
1058
1059
    void push_back(value_type __c);
1060
    _LIBCPP_INLINE_VISIBILITY
1061
    void pop_back();
1062
    _LIBCPP_INLINE_VISIBILITY reference       front() _NOEXCEPT;
1063
    _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT;
1064
    _LIBCPP_INLINE_VISIBILITY reference       back() _NOEXCEPT;
1065
    _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT;
1066
1067
    template <class _Tp>
1068
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1069
    _EnableIf
1070
        <
1071
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1072
            basic_string&
1073
        >
1074
                 assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); }
1075
    _LIBCPP_INLINE_VISIBILITY
1076
    basic_string& assign(const basic_string& __str) { return *this = __str; }
1077
#ifndef _LIBCPP_CXX03_LANG
1078
    _LIBCPP_INLINE_VISIBILITY
1079
    basic_string& assign(basic_string&& __str)
1080
        _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
1081
        {*this = _VSTD::move(__str); return *this;}
1082
#endif
1083
    basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
1084
    template <class _Tp>
1085
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1086
    _EnableIf
1087
        <
1088
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
1089
            && !__is_same_uncvref<_Tp, basic_string>::value,
1090
            basic_string&
1091
        >
1092
                  assign(const _Tp & __t, size_type __pos, size_type __n=npos);
1093
    basic_string& assign(const value_type* __s, size_type __n);
1094
    basic_string& assign(const value_type* __s);
1095
    basic_string& assign(size_type __n, value_type __c);
1096
    template<class _InputIterator>
1097
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1098
    _EnableIf
1099
        <
1100
           __is_exactly_cpp17_input_iterator<_InputIterator>::value
1101
                || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1102
            basic_string&
1103
        >
1104
        assign(_InputIterator __first, _InputIterator __last);
1105
    template<class _ForwardIterator>
1106
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1107
    _EnableIf
1108
        <
1109
            __is_cpp17_forward_iterator<_ForwardIterator>::value
1110
                 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1111
            basic_string&
1112
        >
1113
        assign(_ForwardIterator __first, _ForwardIterator __last);
1114
#ifndef _LIBCPP_CXX03_LANG
1115
    _LIBCPP_INLINE_VISIBILITY
1116
    basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
1117
#endif  // _LIBCPP_CXX03_LANG
1118
1119
    _LIBCPP_INLINE_VISIBILITY
1120
    basic_string& insert(size_type __pos1, const basic_string& __str);
1121
1122
    template <class _Tp>
1123
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1124
    _EnableIf
1125
        <
1126
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1127
            basic_string&
1128
        >
1129
                 insert(size_type __pos1, const _Tp& __t)
1130
    { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); }
1131
1132
    template <class _Tp>
1133
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1134
    _EnableIf
1135
        <
1136
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value,
1137
            basic_string&
1138
        >
1139
                  insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos);
1140
    basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos);
1141
    basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
1142
    basic_string& insert(size_type __pos, const value_type* __s);
1143
    basic_string& insert(size_type __pos, size_type __n, value_type __c);
1144
    iterator      insert(const_iterator __pos, value_type __c);
1145
    _LIBCPP_INLINE_VISIBILITY
1146
    iterator      insert(const_iterator __pos, size_type __n, value_type __c);
1147
    template<class _InputIterator>
1148
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1149
    _EnableIf
1150
        <
1151
           __is_exactly_cpp17_input_iterator<_InputIterator>::value
1152
                || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
1153
            iterator
1154
        >
1155
        insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
1156
    template<class _ForwardIterator>
1157
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1158
    _EnableIf
1159
        <
1160
            __is_cpp17_forward_iterator<_ForwardIterator>::value
1161
                 && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
1162
            iterator
1163
        >
1164
        insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
1165
#ifndef _LIBCPP_CXX03_LANG
1166
    _LIBCPP_INLINE_VISIBILITY
1167
    iterator insert(const_iterator __pos, initializer_list<value_type> __il)
1168
                    {return insert(__pos, __il.begin(), __il.end());}
1169
#endif  // _LIBCPP_CXX03_LANG
1170
1171
    basic_string& erase(size_type __pos = 0, size_type __n = npos);
1172
    _LIBCPP_INLINE_VISIBILITY
1173
    iterator      erase(const_iterator __pos);
1174
    _LIBCPP_INLINE_VISIBILITY
1175
    iterator      erase(const_iterator __first, const_iterator __last);
1176
1177
    _LIBCPP_INLINE_VISIBILITY
1178
    basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
1179
1180
    template <class _Tp>
1181
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1182
    _EnableIf
1183
        <
1184
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1185
            basic_string&
1186
        >
1187
                  replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); }
1188
    basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
1189
    template <class _Tp>
1190
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1191
    _EnableIf
1192
        <
1193
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string>::value,
1194
            basic_string&
1195
        >
1196
                  replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos);
1197
    basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
1198
    basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
1199
    basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
1200
    _LIBCPP_INLINE_VISIBILITY
1201
    basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
1202
1203
    template <class _Tp>
1204
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1205
    _EnableIf
1206
        <
1207
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1208
            basic_string&
1209
        >
1210
                  replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); }
1211
1212
    _LIBCPP_INLINE_VISIBILITY
1213
    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
1214
    _LIBCPP_INLINE_VISIBILITY
1215
    basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s);
1216
    _LIBCPP_INLINE_VISIBILITY
1217
    basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
1218
    template<class _InputIterator>
1219
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1220
    _EnableIf
1221
        <
1222
            __is_cpp17_input_iterator<_InputIterator>::value,
1223
            basic_string&
1224
        >
1225
        replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
1226
#ifndef _LIBCPP_CXX03_LANG
1227
    _LIBCPP_INLINE_VISIBILITY
1228
    basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
1229
        {return replace(__i1, __i2, __il.begin(), __il.end());}
1230
#endif  // _LIBCPP_CXX03_LANG
1231
1232
    size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
1233
    _LIBCPP_INLINE_VISIBILITY
1234
    basic_string substr(size_type __pos = 0, size_type __n = npos) const;
1235
1236
    _LIBCPP_INLINE_VISIBILITY
1237
    void swap(basic_string& __str)
1238
#if _LIBCPP_STD_VER >= 14
1239
        _NOEXCEPT;
1240
#else
1241
        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
1242
                    __is_nothrow_swappable<allocator_type>::value);
1243
#endif
1244
1245
    _LIBCPP_INLINE_VISIBILITY
1246
1.60G
    const value_type* c_str() const _NOEXCEPT {return data();}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str() const
Line
Count
Source
1246
1.60G
    const value_type* c_str() const _NOEXCEPT {return data();}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::c_str() const
Line
Count
Source
1246
37
    const value_type* c_str() const _NOEXCEPT {return data();}
1247
    _LIBCPP_INLINE_VISIBILITY
1248
3.60G
    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_address(__get_pointer());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data() const
Line
Count
Source
1248
3.60G
    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_address(__get_pointer());}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::data() const
Line
Count
Source
1248
143
    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_address(__get_pointer());}
1249
#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY)
1250
    _LIBCPP_INLINE_VISIBILITY
1251
0
    value_type* data()             _NOEXCEPT  {return _VSTD::__to_address(__get_pointer());}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data()
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::data()
1252
#endif
1253
1254
    _LIBCPP_INLINE_VISIBILITY
1255
35.0M
    allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
1256
1257
    _LIBCPP_INLINE_VISIBILITY
1258
    size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1259
1260
    template <class _Tp>
1261
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1262
    _EnableIf
1263
        <
1264
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1265
            size_type
1266
        >
1267
              find(const _Tp& __t, size_type __pos = 0) const;
1268
    size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1269
    _LIBCPP_INLINE_VISIBILITY
1270
    size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
1271
    size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1272
1273
    _LIBCPP_INLINE_VISIBILITY
1274
    size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1275
1276
    template <class _Tp>
1277
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1278
    _EnableIf
1279
        <
1280
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1281
            size_type
1282
        >
1283
              rfind(const _Tp& __t, size_type __pos = npos) const;
1284
    size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1285
    _LIBCPP_INLINE_VISIBILITY
1286
    size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
1287
    size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1288
1289
    _LIBCPP_INLINE_VISIBILITY
1290
    size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1291
1292
    template <class _Tp>
1293
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1294
    _EnableIf
1295
        <
1296
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1297
            size_type
1298
        >
1299
              find_first_of(const _Tp& __t, size_type __pos = 0) const;
1300
    size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1301
    _LIBCPP_INLINE_VISIBILITY
1302
    size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
1303
    _LIBCPP_INLINE_VISIBILITY
1304
    size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1305
1306
    _LIBCPP_INLINE_VISIBILITY
1307
    size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1308
1309
    template <class _Tp>
1310
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1311
    _EnableIf
1312
        <
1313
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1314
            size_type
1315
        >
1316
              find_last_of(const _Tp& __t, size_type __pos = npos) const;
1317
    size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1318
    _LIBCPP_INLINE_VISIBILITY
1319
    size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
1320
    _LIBCPP_INLINE_VISIBILITY
1321
    size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1322
1323
    _LIBCPP_INLINE_VISIBILITY
1324
    size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1325
1326
    template <class _Tp>
1327
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1328
    _EnableIf
1329
        <
1330
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1331
            size_type
1332
        >
1333
              find_first_not_of(const _Tp &__t, size_type __pos = 0) const;
1334
    size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1335
    _LIBCPP_INLINE_VISIBILITY
1336
    size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
1337
    _LIBCPP_INLINE_VISIBILITY
1338
    size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1339
1340
    _LIBCPP_INLINE_VISIBILITY
1341
    size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1342
1343
    template <class _Tp>
1344
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1345
    _EnableIf
1346
        <
1347
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1348
            size_type
1349
        >
1350
              find_last_not_of(const _Tp& __t, size_type __pos = npos) const;
1351
    size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
1352
    _LIBCPP_INLINE_VISIBILITY
1353
    size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
1354
    _LIBCPP_INLINE_VISIBILITY
1355
    size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1356
1357
    _LIBCPP_INLINE_VISIBILITY
1358
    int compare(const basic_string& __str) const _NOEXCEPT;
1359
1360
    template <class _Tp>
1361
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1362
    _EnableIf
1363
        <
1364
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1365
            int
1366
        >
1367
        compare(const _Tp &__t) const;
1368
1369
    template <class _Tp>
1370
    _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1371
    _EnableIf
1372
        <
1373
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
1374
            int
1375
        >
1376
         compare(size_type __pos1, size_type __n1, const _Tp& __t) const;
1377
1378
    _LIBCPP_INLINE_VISIBILITY
1379
    int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
1380
    int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
1381
1382
    template <class _Tp>
1383
    inline _LIBCPP_INLINE_VISIBILITY
1384
        _EnableIf
1385
        <
1386
            __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string>::value,
1387
            int
1388
        >
1389
        compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const;
1390
    int compare(const value_type* __s) const _NOEXCEPT;
1391
    int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
1392
    int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
1393
1394
#if _LIBCPP_STD_VER > 17
1395
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1396
    bool starts_with(__self_view __sv) const _NOEXCEPT
1397
    { return __self_view(data(), size()).starts_with(__sv); }
1398
1399
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1400
    bool starts_with(value_type __c) const _NOEXCEPT
1401
    { return !empty() && _Traits::eq(front(), __c); }
1402
1403
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1404
    bool starts_with(const value_type* __s) const _NOEXCEPT
1405
    { return starts_with(__self_view(__s)); }
1406
1407
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1408
    bool ends_with(__self_view __sv) const _NOEXCEPT
1409
    { return __self_view(data(), size()).ends_with( __sv); }
1410
1411
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1412
    bool ends_with(value_type __c) const _NOEXCEPT
1413
    { return !empty() && _Traits::eq(back(), __c); }
1414
1415
    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1416
    bool ends_with(const value_type* __s) const _NOEXCEPT
1417
    { return ends_with(__self_view(__s)); }
1418
#endif
1419
1420
    _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
1421
1422
    _LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
1423
1424
    _LIBCPP_INLINE_VISIBILITY
1425
    bool __is_long() const _NOEXCEPT
1426
9.94G
        {return bool(__r_.first().__s.__size_ & __short_mask);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const
Line
Count
Source
1426
9.94G
        {return bool(__r_.first().__s.__size_ & __short_mask);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__is_long() const
Line
Count
Source
1426
602
        {return bool(__r_.first().__s.__size_ & __short_mask);}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__is_long() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__is_long() const
1427
1428
#if _LIBCPP_DEBUG_LEVEL >= 2
1429
1430
    bool __dereferenceable(const const_iterator* __i) const;
1431
    bool __decrementable(const const_iterator* __i) const;
1432
    bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
1433
    bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
1434
1435
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1436
1437
private:
1438
    _LIBCPP_INLINE_VISIBILITY
1439
    allocator_type& __alloc() _NOEXCEPT
1440
763M
        {return __r_.second();}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__alloc()
Line
Count
Source
1440
763M
        {return __r_.second();}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__alloc()
Line
Count
Source
1440
81
        {return __r_.second();}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__alloc()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__alloc()
1441
    _LIBCPP_INLINE_VISIBILITY
1442
    const allocator_type& __alloc() const _NOEXCEPT
1443
390M
        {return __r_.second();}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__alloc() const
Line
Count
Source
1443
390M
        {return __r_.second();}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__alloc() const
Line
Count
Source
1443
32
        {return __r_.second();}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__alloc() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__alloc() const
1444
1445
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
1446
1447
    _LIBCPP_INLINE_VISIBILITY
1448
    void __set_short_size(size_type __s) _NOEXCEPT
1449
#   ifdef _LIBCPP_BIG_ENDIAN
1450
        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
1451
#   else
1452
        {__r_.first().__s.__size_ = (unsigned char)(__s);}
1453
#   endif
1454
1455
    _LIBCPP_INLINE_VISIBILITY
1456
    size_type __get_short_size() const _NOEXCEPT
1457
#   ifdef _LIBCPP_BIG_ENDIAN
1458
        {return __r_.first().__s.__size_ >> 1;}
1459
#   else
1460
        {return __r_.first().__s.__size_;}
1461
#   endif
1462
1463
#else  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
1464
1465
    _LIBCPP_INLINE_VISIBILITY
1466
    void __set_short_size(size_type __s) _NOEXCEPT
1467
#   ifdef _LIBCPP_BIG_ENDIAN
1468
        {__r_.first().__s.__size_ = (unsigned char)(__s);}
1469
#   else
1470
262M
        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__set_short_size(unsigned long)
Line
Count
Source
1470
262M
        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__set_short_size(unsigned long)
Line
Count
Source
1470
5
        {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__set_short_size(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__set_short_size(unsigned long)
1471
#   endif
1472
1473
    _LIBCPP_INLINE_VISIBILITY
1474
    size_type __get_short_size() const _NOEXCEPT
1475
#   ifdef _LIBCPP_BIG_ENDIAN
1476
        {return __r_.first().__s.__size_;}
1477
#   else
1478
1.97G
        {return __r_.first().__s.__size_ >> 1;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_short_size() const
Line
Count
Source
1478
1.97G
        {return __r_.first().__s.__size_ >> 1;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_short_size() const
Line
Count
Source
1478
60
        {return __r_.first().__s.__size_ >> 1;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_short_size() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_short_size() const
1479
#   endif
1480
1481
#endif  // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
1482
1483
    _LIBCPP_INLINE_VISIBILITY
1484
    void __set_long_size(size_type __s) _NOEXCEPT
1485
353M
        {__r_.first().__l.__size_ = __s;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__set_long_size(unsigned long)
Line
Count
Source
1485
353M
        {__r_.first().__l.__size_ = __s;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__set_long_size(unsigned long)
Line
Count
Source
1485
3
        {__r_.first().__l.__size_ = __s;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__set_long_size(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__set_long_size(unsigned long)
1486
    _LIBCPP_INLINE_VISIBILITY
1487
    size_type __get_long_size() const _NOEXCEPT
1488
707M
        {return __r_.first().__l.__size_;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_long_size() const
Line
Count
Source
1488
707M
        {return __r_.first().__l.__size_;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_long_size() const
Line
Count
Source
1488
124
        {return __r_.first().__l.__size_;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_long_size() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_long_size() const
1489
    _LIBCPP_INLINE_VISIBILITY
1490
    void __set_size(size_type __s) _NOEXCEPT
1491
75.2M
        {if (__is_long()) 
__set_long_size(__s)27.5M
; else
__set_short_size(__s)47.7M
;}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__set_size(unsigned long)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__set_size(unsigned long)
Line
Count
Source
1491
75.2M
        {if (__is_long()) 
__set_long_size(__s)27.5M
; else
__set_short_size(__s)47.7M
;}
1492
1493
    _LIBCPP_INLINE_VISIBILITY
1494
    void __set_long_cap(size_type __s) _NOEXCEPT
1495
156M
        {__r_.first().__l.__cap_  = __long_mask | __s;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__set_long_cap(unsigned long)
Line
Count
Source
1495
156M
        {__r_.first().__l.__cap_  = __long_mask | __s;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__set_long_cap(unsigned long)
Line
Count
Source
1495
2
        {__r_.first().__l.__cap_  = __long_mask | __s;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__set_long_cap(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__set_long_cap(unsigned long)
1496
    _LIBCPP_INLINE_VISIBILITY
1497
    size_type __get_long_cap() const _NOEXCEPT
1498
530M
        {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_long_cap() const
Line
Count
Source
1498
530M
        {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_long_cap() const
Line
Count
Source
1498
81
        {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_long_cap() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_long_cap() const
1499
1500
    _LIBCPP_INLINE_VISIBILITY
1501
    void __set_long_pointer(pointer __p) _NOEXCEPT
1502
156M
        {__r_.first().__l.__data_ = __p;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__set_long_pointer(char*)
Line
Count
Source
1502
156M
        {__r_.first().__l.__data_ = __p;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__set_long_pointer(wchar_t*)
Line
Count
Source
1502
2
        {__r_.first().__l.__data_ = __p;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__set_long_pointer(char16_t*)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__set_long_pointer(char32_t*)
1503
    _LIBCPP_INLINE_VISIBILITY
1504
    pointer __get_long_pointer() _NOEXCEPT
1505
1.81G
        {return __r_.first().__l.__data_;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_long_pointer()
Line
Count
Source
1505
1.81G
        {return __r_.first().__l.__data_;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_long_pointer()
Line
Count
Source
1505
80
        {return __r_.first().__l.__data_;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_long_pointer()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_long_pointer()
1506
    _LIBCPP_INLINE_VISIBILITY
1507
    const_pointer __get_long_pointer() const _NOEXCEPT
1508
1.34G
        {return __r_.first().__l.__data_;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_long_pointer() const
Line
Count
Source
1508
1.34G
        {return __r_.first().__l.__data_;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_long_pointer() const
Line
Count
Source
1508
91
        {return __r_.first().__l.__data_;}
1509
    _LIBCPP_INLINE_VISIBILITY
1510
    pointer __get_short_pointer() _NOEXCEPT
1511
374M
        {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_short_pointer()
Line
Count
Source
1511
374M
        {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_short_pointer()
Line
Count
Source
1511
9
        {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_short_pointer()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_short_pointer()
1512
    _LIBCPP_INLINE_VISIBILITY
1513
    const_pointer __get_short_pointer() const _NOEXCEPT
1514
2.31G
        {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_short_pointer() const
Line
Count
Source
1514
2.31G
        {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_short_pointer() const
Line
Count
Source
1514
68
        {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
1515
    _LIBCPP_INLINE_VISIBILITY
1516
    pointer __get_pointer() _NOEXCEPT
1517
1.47G
        {return __is_long() ? 
__get_long_pointer()1.32G
:
__get_short_pointer()159M
;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer()
Line
Count
Source
1517
1.47G
        {return __is_long() ? 
__get_long_pointer()1.32G
:
__get_short_pointer()159M
;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_pointer()
Line
Count
Source
1517
14
        {return __is_long() ? 
__get_long_pointer()10
:
__get_short_pointer()4
;}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__get_pointer()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__get_pointer()
1518
    _LIBCPP_INLINE_VISIBILITY
1519
    const_pointer __get_pointer() const _NOEXCEPT
1520
3.60G
        {return __is_long() ? 
__get_long_pointer()1.28G
:
__get_short_pointer()2.31G
;}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer() const
Line
Count
Source
1520
3.60G
        {return __is_long() ? 
__get_long_pointer()1.28G
:
__get_short_pointer()2.31G
;}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__get_pointer() const
Line
Count
Source
1520
159
        {return __is_long() ? 
__get_long_pointer()91
:
__get_short_pointer()68
;}
1521
1522
    _LIBCPP_INLINE_VISIBILITY
1523
    void __zero() _NOEXCEPT
1524
838M
        {
1525
838M
            size_type (&__a)[__n_words] = __r_.first().__r.__words;
1526
3.35G
            for (unsigned __i = 0; __i < __n_words; 
++__i2.51G
)
1527
2.51G
                __a[__i] = 0;
1528
838M
        }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__zero()
Line
Count
Source
1524
838M
        {
1525
838M
            size_type (&__a)[__n_words] = __r_.first().__r.__words;
1526
3.35G
            for (unsigned __i = 0; __i < __n_words; 
++__i2.51G
)
1527
2.51G
                __a[__i] = 0;
1528
838M
        }
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__zero()
Line
Count
Source
1524
85
        {
1525
85
            size_type (&__a)[__n_words] = __r_.first().__r.__words;
1526
340
            for (unsigned __i = 0; __i < __n_words; 
++__i255
)
1527
255
                __a[__i] = 0;
1528
85
        }
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__zero()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__zero()
1529
1530
    template <size_type __a> static
1531
        _LIBCPP_INLINE_VISIBILITY
1532
        size_type __align_it(size_type __s) _NOEXCEPT
1533
156M
            {return (__s + (__a-1)) & ~(__a-1);}
unsigned long std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__align_it<16ul>(unsigned long)
Line
Count
Source
1533
156M
            {return (__s + (__a-1)) & ~(__a-1);}
unsigned long std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__align_it<4ul>(unsigned long)
Line
Count
Source
1533
2
            {return (__s + (__a-1)) & ~(__a-1);}
Unexecuted instantiation: unsigned long std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__align_it<8ul>(unsigned long)
Unexecuted instantiation: unsigned long std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__align_it<4ul>(unsigned long)
1534
    enum {__alignment = 16};
1535
    static _LIBCPP_INLINE_VISIBILITY
1536
    size_type __recommend(size_type __s) _NOEXCEPT
1537
161M
        {
1538
161M
        if (__s < __min_cap) 
return static_cast<size_type>(__min_cap) - 15.68M
;
1539
156M
        size_type __guess = __align_it<sizeof(value_type) < __alignment ?
1540
156M
                     __alignment/sizeof(value_type) : 1 > (__s+1) - 1;
1541
156M
        if (__guess == __min_cap) 
++__guess0
;
1542
156M
        return __guess;
1543
156M
        }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__recommend(unsigned long)
Line
Count
Source
1537
161M
        {
1538
161M
        if (__s < __min_cap) 
return static_cast<size_type>(__min_cap) - 15.68M
;
1539
156M
        size_type __guess = __align_it<sizeof(value_type) < __alignment ?
1540
156M
                     __alignment/sizeof(value_type) : 1 > (__s+1) - 1;
1541
156M
        if (__guess == __min_cap) 
++__guess0
;
1542
156M
        return __guess;
1543
156M
        }
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__recommend(unsigned long)
Line
Count
Source
1537
2
        {
1538
2
        if (__s < __min_cap) 
return static_cast<size_type>(__min_cap) - 10
;
1539
2
        size_type __guess = __align_it<sizeof(value_type) < __alignment ?
1540
2
                     __alignment/sizeof(value_type) : 1 > (__s+1) - 1;
1541
2
        if (__guess == __min_cap) 
++__guess0
;
1542
2
        return __guess;
1543
2
        }
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__recommend(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__recommend(unsigned long)
1544
1545
    inline
1546
    void __init(const value_type* __s, size_type __sz, size_type __reserve);
1547
    inline
1548
    void __init(const value_type* __s, size_type __sz);
1549
    inline
1550
    void __init(size_type __n, value_type __c);
1551
1552
    template <class _InputIterator>
1553
    inline
1554
    _EnableIf
1555
    <
1556
        __is_exactly_cpp17_input_iterator<_InputIterator>::value
1557
    >
1558
    __init(_InputIterator __first, _InputIterator __last);
1559
1560
    template <class _ForwardIterator>
1561
    inline
1562
    _EnableIf
1563
    <
1564
        __is_cpp17_forward_iterator<_ForwardIterator>::value
1565
    >
1566
    __init(_ForwardIterator __first, _ForwardIterator __last);
1567
1568
    void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
1569
                   size_type __n_copy,  size_type __n_del,     size_type __n_add = 0);
1570
    void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
1571
                               size_type __n_copy,  size_type __n_del,
1572
                               size_type __n_add, const value_type* __p_new_stuff);
1573
1574
    _LIBCPP_INLINE_VISIBILITY
1575
    void __erase_to_end(size_type __pos);
1576
1577
    _LIBCPP_INLINE_VISIBILITY
1578
    void __copy_assign_alloc(const basic_string& __str)
1579
337k
        {__copy_assign_alloc(__str, integral_constant<bool,
1580
337k
                      __alloc_traits::propagate_on_container_copy_assignment::value>());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__copy_assign_alloc(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
1579
337k
        {__copy_assign_alloc(__str, integral_constant<bool,
1580
337k
                      __alloc_traits::propagate_on_container_copy_assignment::value>());}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__copy_assign_alloc(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
1581
1582
    _LIBCPP_INLINE_VISIBILITY
1583
    void __copy_assign_alloc(const basic_string& __str, true_type)
1584
        {
1585
            if (__alloc() == __str.__alloc())
1586
                __alloc() = __str.__alloc();
1587
            else
1588
            {
1589
                if (!__str.__is_long())
1590
                {
1591
                    __clear_and_shrink();
1592
                    __alloc() = __str.__alloc();
1593
                }
1594
                else
1595
                {
1596
                    allocator_type __a = __str.__alloc();
1597
                    pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap());
1598
                    __clear_and_shrink();
1599
                    __alloc() = _VSTD::move(__a);
1600
                    __set_long_pointer(__p);
1601
                    __set_long_cap(__str.__get_long_cap());
1602
                    __set_long_size(__str.size());
1603
                }
1604
            }
1605
        }
1606
1607
    _LIBCPP_INLINE_VISIBILITY
1608
    void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
1609
337k
        {}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__copy_assign_alloc(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::integral_constant<bool, false>)
Line
Count
Source
1609
337k
        {}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__copy_assign_alloc(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, std::__1::integral_constant<bool, false>)
1610
1611
#ifndef _LIBCPP_CXX03_LANG
1612
    _LIBCPP_INLINE_VISIBILITY
1613
    void __move_assign(basic_string& __str, false_type)
1614
        _NOEXCEPT_(__alloc_traits::is_always_equal::value);
1615
    _LIBCPP_INLINE_VISIBILITY
1616
    void __move_assign(basic_string& __str, true_type)
1617
#if _LIBCPP_STD_VER > 14
1618
        _NOEXCEPT;
1619
#else
1620
        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
1621
#endif
1622
#endif
1623
1624
    _LIBCPP_INLINE_VISIBILITY
1625
    void
1626
    __move_assign_alloc(basic_string& __str)
1627
        _NOEXCEPT_(
1628
            !__alloc_traits::propagate_on_container_move_assignment::value ||
1629
            is_nothrow_move_assignable<allocator_type>::value)
1630
85.7M
    {__move_assign_alloc(__str, integral_constant<bool,
1631
85.7M
                      __alloc_traits::propagate_on_container_move_assignment::value>());}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign_alloc(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)
Line
Count
Source
1630
85.7M
    {__move_assign_alloc(__str, integral_constant<bool,
1631
85.7M
                      __alloc_traits::propagate_on_container_move_assignment::value>());}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__move_assign_alloc(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&)
Line
Count
Source
1630
5
    {__move_assign_alloc(__str, integral_constant<bool,
1631
5
                      __alloc_traits::propagate_on_container_move_assignment::value>());}
1632
1633
    _LIBCPP_INLINE_VISIBILITY
1634
    void __move_assign_alloc(basic_string& __c, true_type)
1635
        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
1636
85.7M
        {
1637
85.7M
            __alloc() = _VSTD::move(__c.__alloc());
1638
85.7M
        }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign_alloc(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::integral_constant<bool, true>)
Line
Count
Source
1636
85.7M
        {
1637
85.7M
            __alloc() = _VSTD::move(__c.__alloc());
1638
85.7M
        }
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__move_assign_alloc(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, std::__1::integral_constant<bool, true>)
Line
Count
Source
1636
5
        {
1637
5
            __alloc() = _VSTD::move(__c.__alloc());
1638
5
        }
1639
1640
    _LIBCPP_INLINE_VISIBILITY
1641
    void __move_assign_alloc(basic_string&, false_type)
1642
        _NOEXCEPT
1643
        {}
1644
1645
    _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
1646
    _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
1647
1648
    friend basic_string operator+<>(const basic_string&, const basic_string&);
1649
    friend basic_string operator+<>(const value_type*, const basic_string&);
1650
    friend basic_string operator+<>(value_type, const basic_string&);
1651
    friend basic_string operator+<>(const basic_string&, const value_type*);
1652
    friend basic_string operator+<>(const basic_string&, value_type);
1653
};
1654
1655
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1656
template<class _InputIterator,
1657
         class _CharT = typename iterator_traits<_InputIterator>::value_type,
1658
         class _Allocator = allocator<_CharT>,
1659
         class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
1660
         class = _EnableIf<__is_allocator<_Allocator>::value>
1661
         >
1662
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
1663
  -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
1664
1665
template<class _CharT,
1666
         class _Traits,
1667
         class _Allocator = allocator<_CharT>,
1668
         class = _EnableIf<__is_allocator<_Allocator>::value>
1669
         >
1670
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
1671
  -> basic_string<_CharT, _Traits, _Allocator>;
1672
1673
template<class _CharT,
1674
         class _Traits,
1675
         class _Allocator = allocator<_CharT>,
1676
         class = _EnableIf<__is_allocator<_Allocator>::value>,
1677
         class _Sz = typename allocator_traits<_Allocator>::size_type
1678
         >
1679
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
1680
  -> basic_string<_CharT, _Traits, _Allocator>;
1681
#endif
1682
1683
template <class _CharT, class _Traits, class _Allocator>
1684
inline
1685
void
1686
basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
1687
51.3M
{
1688
#if _LIBCPP_DEBUG_LEVEL >= 2
1689
    __get_db()->__invalidate_all(this);
1690
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1691
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__invalidate_all_iterators()
Line
Count
Source
1687
51.3M
{
1688
#if _LIBCPP_DEBUG_LEVEL >= 2
1689
    __get_db()->__invalidate_all(this);
1690
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1691
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__invalidate_all_iterators()
Line
Count
Source
1687
1
{
1688
#if _LIBCPP_DEBUG_LEVEL >= 2
1689
    __get_db()->__invalidate_all(this);
1690
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1691
}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__invalidate_all_iterators()
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__invalidate_all_iterators()
1692
1693
template <class _CharT, class _Traits, class _Allocator>
1694
inline
1695
void
1696
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
1697
#if _LIBCPP_DEBUG_LEVEL >= 2
1698
                                                                        __pos
1699
#endif
1700
                                                                      )
1701
17.5M
{
1702
#if _LIBCPP_DEBUG_LEVEL >= 2
1703
    __c_node* __c = __get_db()->__find_c_and_lock(this);
1704
    if (__c)
1705
    {
1706
        const_pointer __new_last = __get_pointer() + __pos;
1707
        for (__i_node** __p = __c->end_; __p != __c->beg_; )
1708
        {
1709
            --__p;
1710
            const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
1711
            if (__i->base() > __new_last)
1712
            {
1713
                (*__p)->__c_ = nullptr;
1714
                if (--__c->end_ != __p)
1715
                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
1716
            }
1717
        }
1718
        __get_db()->unlock();
1719
    }
1720
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1721
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__invalidate_iterators_past(unsigned long)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__invalidate_iterators_past(unsigned long)
Line
Count
Source
1701
17.5M
{
1702
#if _LIBCPP_DEBUG_LEVEL >= 2
1703
    __c_node* __c = __get_db()->__find_c_and_lock(this);
1704
    if (__c)
1705
    {
1706
        const_pointer __new_last = __get_pointer() + __pos;
1707
        for (__i_node** __p = __c->end_; __p != __c->beg_; )
1708
        {
1709
            --__p;
1710
            const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
1711
            if (__i->base() > __new_last)
1712
            {
1713
                (*__p)->__c_ = nullptr;
1714
                if (--__c->end_ != __p)
1715
                    memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
1716
            }
1717
        }
1718
        __get_db()->unlock();
1719
    }
1720
#endif  // _LIBCPP_DEBUG_LEVEL >= 2
1721
}
1722
1723
template <class _CharT, class _Traits, class _Allocator>
1724
inline
1725
basic_string<_CharT, _Traits, _Allocator>::basic_string()
1726
    _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1727
     : __r_(__default_init_tag(), __default_init_tag())
1728
441M
{
1729
#if _LIBCPP_DEBUG_LEVEL >= 2
1730
    __get_db()->__insert_c(this);
1731
#endif
1732
    __zero();
1733
441M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string()
Line
Count
Source
1728
441M
{
1729
#if _LIBCPP_DEBUG_LEVEL >= 2
1730
    __get_db()->__insert_c(this);
1731
#endif
1732
    __zero();
1733
441M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string()
Line
Count
Source
1728
11
{
1729
#if _LIBCPP_DEBUG_LEVEL >= 2
1730
    __get_db()->__insert_c(this);
1731
#endif
1732
    __zero();
1733
11
}
1734
1735
template <class _CharT, class _Traits, class _Allocator>
1736
inline
1737
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
1738
#if _LIBCPP_STD_VER <= 14
1739
        _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
1740
#else
1741
        _NOEXCEPT
1742
#endif
1743
: __r_(__default_init_tag(), __a)
1744
15.3M
{
1745
#if _LIBCPP_DEBUG_LEVEL >= 2
1746
    __get_db()->__insert_c(this);
1747
#endif
1748
    __zero();
1749
15.3M
}
1750
1751
template <class _CharT, class _Traits, class _Allocator>
1752
void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
1753
                                                       size_type __sz,
1754
                                                       size_type __reserve)
1755
9.21M
{
1756
9.21M
    if (__reserve > max_size())
1757
0
        this->__throw_length_error();
1758
9.21M
    pointer __p;
1759
9.21M
    if (__reserve < __min_cap)
1760
3.12M
    {
1761
3.12M
        __set_short_size(__sz);
1762
3.12M
        __p = __get_short_pointer();
1763
3.12M
    }
1764
6.08M
    else
1765
6.08M
    {
1766
6.08M
        size_type __cap = __recommend(__reserve);
1767
6.08M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1768
6.08M
        __set_long_pointer(__p);
1769
6.08M
        __set_long_cap(__cap+1);
1770
6.08M
        __set_long_size(__sz);
1771
6.08M
    }
1772
9.21M
    traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1773
9.21M
    traits_type::assign(__p[__sz], value_type());
1774
9.21M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)
Line
Count
Source
1755
9.21M
{
1756
9.21M
    if (__reserve > max_size())
1757
0
        this->__throw_length_error();
1758
9.21M
    pointer __p;
1759
9.21M
    if (__reserve < __min_cap)
1760
3.12M
    {
1761
3.12M
        __set_short_size(__sz);
1762
3.12M
        __p = __get_short_pointer();
1763
3.12M
    }
1764
6.08M
    else
1765
6.08M
    {
1766
6.08M
        size_type __cap = __recommend(__reserve);
1767
6.08M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1768
6.08M
        __set_long_pointer(__p);
1769
6.08M
        __set_long_cap(__cap+1);
1770
6.08M
        __set_long_size(__sz);
1771
6.08M
    }
1772
9.21M
    traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1773
9.21M
    traits_type::assign(__p[__sz], value_type());
1774
9.21M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init(wchar_t const*, unsigned long, unsigned long)
1775
1776
template <class _CharT, class _Traits, class _Allocator>
1777
void
1778
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
1779
168M
{
1780
168M
    if (__sz > max_size())
1781
0
        this->__throw_length_error();
1782
168M
    pointer __p;
1783
168M
    if (__sz < __min_cap)
1784
72.6M
    {
1785
72.6M
        __set_short_size(__sz);
1786
72.6M
        __p = __get_short_pointer();
1787
72.6M
    }
1788
95.9M
    else
1789
95.9M
    {
1790
95.9M
        size_type __cap = __recommend(__sz);
1791
95.9M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1792
95.9M
        __set_long_pointer(__p);
1793
95.9M
        __set_long_cap(__cap+1);
1794
95.9M
        __set_long_size(__sz);
1795
95.9M
    }
1796
168M
    traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1797
168M
    traits_type::assign(__p[__sz], value_type());
1798
168M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)
Line
Count
Source
1779
168M
{
1780
168M
    if (__sz > max_size())
1781
0
        this->__throw_length_error();
1782
168M
    pointer __p;
1783
168M
    if (__sz < __min_cap)
1784
72.6M
    {
1785
72.6M
        __set_short_size(__sz);
1786
72.6M
        __p = __get_short_pointer();
1787
72.6M
    }
1788
95.9M
    else
1789
95.9M
    {
1790
95.9M
        size_type __cap = __recommend(__sz);
1791
95.9M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1792
95.9M
        __set_long_pointer(__p);
1793
95.9M
        __set_long_cap(__cap+1);
1794
95.9M
        __set_long_size(__sz);
1795
95.9M
    }
1796
168M
    traits_type::copy(_VSTD::__to_address(__p), __s, __sz);
1797
168M
    traits_type::assign(__p[__sz], value_type());
1798
168M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init(wchar_t const*, unsigned long)
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__init(char16_t const*, unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__init(char32_t const*, unsigned long)
1799
1800
template <class _CharT, class _Traits, class _Allocator>
1801
template <class>
1802
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
1803
    : __r_(__default_init_tag(), __a)
1804
{
1805
    _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
1806
    __init(__s, traits_type::length(__s));
1807
#if _LIBCPP_DEBUG_LEVEL >= 2
1808
    __get_db()->__insert_c(this);
1809
#endif
1810
}
1811
1812
template <class _CharT, class _Traits, class _Allocator>
1813
inline
1814
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
1815
     : __r_(__default_init_tag(), __default_init_tag())
1816
{
1817
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
1818
    __init(__s, __n);
1819
#if _LIBCPP_DEBUG_LEVEL >= 2
1820
    __get_db()->__insert_c(this);
1821
#endif
1822
}
1823
1824
template <class _CharT, class _Traits, class _Allocator>
1825
inline
1826
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
1827
    : __r_(__default_init_tag(), __a)
1828
{
1829
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
1830
    __init(__s, __n);
1831
#if _LIBCPP_DEBUG_LEVEL >= 2
1832
    __get_db()->__insert_c(this);
1833
#endif
1834
}
1835
1836
template <class _CharT, class _Traits, class _Allocator>
1837
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
1838
    : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
1839
99.3M
{
1840
99.3M
    if (!__str.__is_long())
1841
38.1M
        __r_.first().__r = __str.__r_.first().__r;
1842
61.1M
    else
1843
61.1M
        __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1844
#if _LIBCPP_DEBUG_LEVEL >= 2
1845
    __get_db()->__insert_c(this);
1846
#endif
1847
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
1839
99.3M
{
1840
99.3M
    if (!__str.__is_long())
1841
38.1M
        __r_.first().__r = __str.__r_.first().__r;
1842
61.1M
    else
1843
61.1M
        __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1844
#if _LIBCPP_DEBUG_LEVEL >= 2
1845
    __get_db()->__insert_c(this);
1846
#endif
1847
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
1848
1849
template <class _CharT, class _Traits, class _Allocator>
1850
basic_string<_CharT, _Traits, _Allocator>::basic_string(
1851
    const basic_string& __str, const allocator_type& __a)
1852
    : __r_(__default_init_tag(), __a)
1853
0
{
1854
0
    if (!__str.__is_long())
1855
0
        __r_.first().__r = __str.__r_.first().__r;
1856
0
    else
1857
0
        __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1858
#if _LIBCPP_DEBUG_LEVEL >= 2
1859
    __get_db()->__insert_c(this);
1860
#endif
1861
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::allocator<char> const&)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, std::__1::allocator<wchar_t> const&)
1862
1863
#ifndef _LIBCPP_CXX03_LANG
1864
1865
template <class _CharT, class _Traits, class _Allocator>
1866
inline
1867
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
1868
#if _LIBCPP_STD_VER <= 14
1869
        _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
1870
#else
1871
        _NOEXCEPT
1872
#endif
1873
    : __r_(_VSTD::move(__str.__r_))
1874
381M
{
1875
381M
    __str.__zero();
1876
#if _LIBCPP_DEBUG_LEVEL >= 2
1877
    __get_db()->__insert_c(this);
1878
    if (__is_long())
1879
        __get_db()->swap(this, &__str);
1880
#endif
1881
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Line
Count
Source
1874
381M
{
1875
381M
    __str.__zero();
1876
#if _LIBCPP_DEBUG_LEVEL >= 2
1877
    __get_db()->__insert_c(this);
1878
    if (__is_long())
1879
        __get_db()->swap(this, &__str);
1880
#endif
1881
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&&)
Line
Count
Source
1874
74
{
1875
74
    __str.__zero();
1876
#if _LIBCPP_DEBUG_LEVEL >= 2
1877
    __get_db()->__insert_c(this);
1878
    if (__is_long())
1879
        __get_db()->swap(this, &__str);
1880
#endif
1881
}
1882
1883
template <class _CharT, class _Traits, class _Allocator>
1884
inline
1885
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
1886
    : __r_(__default_init_tag(), __a)
1887
{
1888
    if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
1889
        __init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1890
    else
1891
    {
1892
        __r_.first().__r = __str.__r_.first().__r;
1893
        __str.__zero();
1894
    }
1895
#if _LIBCPP_DEBUG_LEVEL >= 2
1896
    __get_db()->__insert_c(this);
1897
    if (__is_long())
1898
        __get_db()->swap(this, &__str);
1899
#endif
1900
}
1901
1902
#endif  // _LIBCPP_CXX03_LANG
1903
1904
template <class _CharT, class _Traits, class _Allocator>
1905
void
1906
basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
1907
54.7k
{
1908
54.7k
    if (__n > max_size())
1909
0
        this->__throw_length_error();
1910
54.7k
    pointer __p;
1911
54.7k
    if (__n < __min_cap)
1912
38.1k
    {
1913
38.1k
        __set_short_size(__n);
1914
38.1k
        __p = __get_short_pointer();
1915
38.1k
    }
1916
16.5k
    else
1917
16.5k
    {
1918
16.5k
        size_type __cap = __recommend(__n);
1919
16.5k
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1920
16.5k
        __set_long_pointer(__p);
1921
16.5k
        __set_long_cap(__cap+1);
1922
16.5k
        __set_long_size(__n);
1923
16.5k
    }
1924
54.7k
    traits_type::assign(_VSTD::__to_address(__p), __n, __c);
1925
54.7k
    traits_type::assign(__p[__n], value_type());
1926
54.7k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)
Line
Count
Source
1907
54.7k
{
1908
54.7k
    if (__n > max_size())
1909
0
        this->__throw_length_error();
1910
54.7k
    pointer __p;
1911
54.7k
    if (__n < __min_cap)
1912
38.1k
    {
1913
38.1k
        __set_short_size(__n);
1914
38.1k
        __p = __get_short_pointer();
1915
38.1k
    }
1916
16.5k
    else
1917
16.5k
    {
1918
16.5k
        size_type __cap = __recommend(__n);
1919
16.5k
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
1920
16.5k
        __set_long_pointer(__p);
1921
16.5k
        __set_long_cap(__cap+1);
1922
16.5k
        __set_long_size(__n);
1923
16.5k
    }
1924
54.7k
    traits_type::assign(_VSTD::__to_address(__p), __n, __c);
1925
54.7k
    traits_type::assign(__p[__n], value_type());
1926
54.7k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init(unsigned long, wchar_t)
1927
1928
template <class _CharT, class _Traits, class _Allocator>
1929
inline
1930
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
1931
     : __r_(__default_init_tag(), __default_init_tag())
1932
12.1M
{
1933
12.1M
    __init(__n, __c);
1934
#if _LIBCPP_DEBUG_LEVEL >= 2
1935
    __get_db()->__insert_c(this);
1936
#endif
1937
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char)
Line
Count
Source
1932
12.1M
{
1933
12.1M
    __init(__n, __c);
1934
#if _LIBCPP_DEBUG_LEVEL >= 2
1935
    __get_db()->__insert_c(this);
1936
#endif
1937
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string(unsigned long, wchar_t)
Line
Count
Source
1932
6
{
1933
6
    __init(__n, __c);
1934
#if _LIBCPP_DEBUG_LEVEL >= 2
1935
    __get_db()->__insert_c(this);
1936
#endif
1937
}
1938
1939
template <class _CharT, class _Traits, class _Allocator>
1940
template <class>
1941
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
1942
    : __r_(__default_init_tag(), __a)
1943
{
1944
    __init(__n, __c);
1945
#if _LIBCPP_DEBUG_LEVEL >= 2
1946
    __get_db()->__insert_c(this);
1947
#endif
1948
}
1949
1950
template <class _CharT, class _Traits, class _Allocator>
1951
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
1952
                                                        size_type __pos, size_type __n,
1953
                                                        const _Allocator& __a)
1954
    : __r_(__default_init_tag(), __a)
1955
9.02k
{
1956
9.02k
    size_type __str_sz = __str.size();
1957
9.02k
    if (__pos > __str_sz)
1958
0
        this->__throw_out_of_range();
1959
9.02k
    __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
1960
#if _LIBCPP_DEBUG_LEVEL >= 2
1961
    __get_db()->__insert_c(this);
1962
#endif
1963
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)
Line
Count
Source
1955
9.02k
{
1956
9.02k
    size_type __str_sz = __str.size();
1957
9.02k
    if (__pos > __str_sz)
1958
0
        this->__throw_out_of_range();
1959
9.02k
    __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
1960
#if _LIBCPP_DEBUG_LEVEL >= 2
1961
    __get_db()->__insert_c(this);
1962
#endif
1963
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long, std::__1::allocator<wchar_t> const&)
1964
1965
template <class _CharT, class _Traits, class _Allocator>
1966
inline
1967
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
1968
                                                        const _Allocator& __a)
1969
    : __r_(__default_init_tag(), __a)
1970
{
1971
    size_type __str_sz = __str.size();
1972
    if (__pos > __str_sz)
1973
        this->__throw_out_of_range();
1974
    __init(__str.data() + __pos, __str_sz - __pos);
1975
#if _LIBCPP_DEBUG_LEVEL >= 2
1976
    __get_db()->__insert_c(this);
1977
#endif
1978
}
1979
1980
template <class _CharT, class _Traits, class _Allocator>
1981
template <class _Tp, class>
1982
basic_string<_CharT, _Traits, _Allocator>::basic_string(
1983
             const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
1984
    : __r_(__default_init_tag(), __a)
1985
{
1986
    __self_view __sv0 = __t;
1987
    __self_view __sv = __sv0.substr(__pos, __n);
1988
    __init(__sv.data(), __sv.size());
1989
#if _LIBCPP_DEBUG_LEVEL >= 2
1990
    __get_db()->__insert_c(this);
1991
#endif
1992
}
1993
1994
template <class _CharT, class _Traits, class _Allocator>
1995
template <class _Tp, class>
1996
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
1997
     : __r_(__default_init_tag(), __default_init_tag())
1998
0
{
1999
0
    __self_view __sv = __t;
2000
0
    __init(__sv.data(), __sv.size());
2001
#if _LIBCPP_DEBUG_LEVEL >= 2
2002
    __get_db()->__insert_c(this);
2003
#endif
2004
}
2005
2006
template <class _CharT, class _Traits, class _Allocator>
2007
template <class _Tp, class>
2008
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
2009
    : __r_(__default_init_tag(), __a)
2010
{
2011
    __self_view __sv = __t;
2012
    __init(__sv.data(), __sv.size());
2013
#if _LIBCPP_DEBUG_LEVEL >= 2
2014
    __get_db()->__insert_c(this);
2015
#endif
2016
}
2017
2018
template <class _CharT, class _Traits, class _Allocator>
2019
template <class _InputIterator>
2020
_EnableIf
2021
<
2022
    __is_exactly_cpp17_input_iterator<_InputIterator>::value
2023
>
2024
basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
2025
{
2026
    __zero();
2027
#ifndef _LIBCPP_NO_EXCEPTIONS
2028
    try
2029
    {
2030
#endif  // _LIBCPP_NO_EXCEPTIONS
2031
    for (; __first != __last; ++__first)
2032
        push_back(*__first);
2033
#ifndef _LIBCPP_NO_EXCEPTIONS
2034
    }
2035
    catch (...)
2036
    {
2037
        if (__is_long())
2038
            __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
2039
        throw;
2040
    }
2041
#endif  // _LIBCPP_NO_EXCEPTIONS
2042
}
2043
2044
template <class _CharT, class _Traits, class _Allocator>
2045
template <class _ForwardIterator>
2046
_EnableIf
2047
<
2048
    __is_cpp17_forward_iterator<_ForwardIterator>::value
2049
>
2050
basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
2051
30.7M
{
2052
30.7M
    size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
2053
30.7M
    if (__sz > max_size())
2054
0
        this->__throw_length_error();
2055
30.7M
    pointer __p;
2056
30.7M
    if (__sz < __min_cap)
2057
15.5M
    {
2058
15.5M
        __set_short_size(__sz);
2059
15.5M
        __p = __get_short_pointer();
2060
15.5M
    }
2061
15.1M
    else
2062
15.1M
    {
2063
15.1M
        size_type __cap = __recommend(__sz);
2064
15.1M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
2065
15.1M
        __set_long_pointer(__p);
2066
15.1M
        __set_long_cap(__cap+1);
2067
15.1M
        __set_long_size(__sz);
2068
15.1M
    }
2069
1.01G
    for (; __first != __last; 
++__first, (void) ++__p983M
)
2070
983M
        traits_type::assign(*__p, *__first);
2071
30.7M
    traits_type::assign(*__p, value_type());
2072
30.7M
}
std::__1::_MetaBase<__is_cpp17_forward_iterator<char const*>::value>::_EnableIfImpl<void> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init<char const*>(char const*, char const*)
Line
Count
Source
2051
2.23M
{
2052
2.23M
    size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
2053
2.23M
    if (__sz > max_size())
2054
0
        this->__throw_length_error();
2055
2.23M
    pointer __p;
2056
2.23M
    if (__sz < __min_cap)
2057
1.60M
    {
2058
1.60M
        __set_short_size(__sz);
2059
1.60M
        __p = __get_short_pointer();
2060
1.60M
    }
2061
622k
    else
2062
622k
    {
2063
622k
        size_type __cap = __recommend(__sz);
2064
622k
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
2065
622k
        __set_long_pointer(__p);
2066
622k
        __set_long_cap(__cap+1);
2067
622k
        __set_long_size(__sz);
2068
622k
    }
2069
29.3M
    for (; __first != __last; 
++__first, (void) ++__p27.1M
)
2070
27.1M
        traits_type::assign(*__p, *__first);
2071
2.23M
    traits_type::assign(*__p, value_type());
2072
2.23M
}
Unexecuted instantiation: std::__1::_MetaBase<__is_cpp17_forward_iterator<wchar_t const*>::value>::_EnableIfImpl<void> std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init<wchar_t const*>(wchar_t const*, wchar_t const*)
std::__1::_MetaBase<__is_cpp17_forward_iterator<char*>::value>::_EnableIfImpl<void> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init<char*>(char*, char*)
Line
Count
Source
2051
28.5M
{
2052
28.5M
    size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
2053
28.5M
    if (__sz > max_size())
2054
0
        this->__throw_length_error();
2055
28.5M
    pointer __p;
2056
28.5M
    if (__sz < __min_cap)
2057
13.9M
    {
2058
13.9M
        __set_short_size(__sz);
2059
13.9M
        __p = __get_short_pointer();
2060
13.9M
    }
2061
14.5M
    else
2062
14.5M
    {
2063
14.5M
        size_type __cap = __recommend(__sz);
2064
14.5M
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
2065
14.5M
        __set_long_pointer(__p);
2066
14.5M
        __set_long_cap(__cap+1);
2067
14.5M
        __set_long_size(__sz);
2068
14.5M
    }
2069
984M
    for (; __first != __last; 
++__first, (void) ++__p956M
)
2070
956M
        traits_type::assign(*__p, *__first);
2071
28.5M
    traits_type::assign(*__p, value_type());
2072
28.5M
}
std::__1::_MetaBase<__is_cpp17_forward_iterator<wchar_t*>::value>::_EnableIfImpl<void> std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init<wchar_t*>(wchar_t*, wchar_t*)
Line
Count
Source
2051
2
{
2052
2
    size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
2053
2
    if (__sz > max_size())
2054
0
        this->__throw_length_error();
2055
2
    pointer __p;
2056
2
    if (__sz < __min_cap)
2057
0
    {
2058
0
        __set_short_size(__sz);
2059
0
        __p = __get_short_pointer();
2060
0
    }
2061
2
    else
2062
2
    {
2063
2
        size_type __cap = __recommend(__sz);
2064
2
        __p = __alloc_traits::allocate(__alloc(), __cap+1);
2065
2
        __set_long_pointer(__p);
2066
2
        __set_long_cap(__cap+1);
2067
2
        __set_long_size(__sz);
2068
2
    }
2069
284
    for (; __first != __last; 
++__first, (void) ++__p282
)
2070
282
        traits_type::assign(*__p, *__first);
2071
2
    traits_type::assign(*__p, value_type());
2072
2
}
Unexecuted instantiation: std::__1::_MetaBase<__is_cpp17_forward_iterator<char*>::value>::_EnableIfImpl<void> std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__init<char*>(char*, char*)
2073
2074
template <class _CharT, class _Traits, class _Allocator>
2075
template<class _InputIterator, class>
2076
inline
2077
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
2078
     : __r_(__default_init_tag(), __default_init_tag())
2079
11.0M
{
2080
11.0M
    __init(__first, __last);
2081
#if _LIBCPP_DEBUG_LEVEL >= 2
2082
    __get_db()->__insert_c(this);
2083
#endif
2084
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<char const*, void>(char const*, char const*)
Line
Count
Source
2079
2.23M
{
2080
2.23M
    __init(__first, __last);
2081
#if _LIBCPP_DEBUG_LEVEL >= 2
2082
    __get_db()->__insert_c(this);
2083
#endif
2084
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string<wchar_t const*, void>(wchar_t const*, wchar_t const*)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<char*, void>(char*, char*)
Line
Count
Source
2079
8.82M
{
2080
8.82M
    __init(__first, __last);
2081
#if _LIBCPP_DEBUG_LEVEL >= 2
2082
    __get_db()->__insert_c(this);
2083
#endif
2084
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string<char*, void>(char*, char*)
2085
2086
template <class _CharT, class _Traits, class _Allocator>
2087
template<class _InputIterator, class>
2088
inline
2089
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
2090
                                                        const allocator_type& __a)
2091
    : __r_(__default_init_tag(), __a)
2092
19.7M
{
2093
19.7M
    __init(__first, __last);
2094
#if _LIBCPP_DEBUG_LEVEL >= 2
2095
    __get_db()->__insert_c(this);
2096
#endif
2097
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<char*, void>(char*, char*, std::__1::allocator<char> const&)
Line
Count
Source
2092
19.7M
{
2093
19.7M
    __init(__first, __last);
2094
#if _LIBCPP_DEBUG_LEVEL >= 2
2095
    __get_db()->__insert_c(this);
2096
#endif
2097
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::basic_string<wchar_t*, void>(wchar_t*, wchar_t*, std::__1::allocator<wchar_t> const&)
Line
Count
Source
2092
2
{
2093
2
    __init(__first, __last);
2094
#if _LIBCPP_DEBUG_LEVEL >= 2
2095
    __get_db()->__insert_c(this);
2096
#endif
2097
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<char const*, void>(char const*, char const*, std::__1::allocator<char> const&)
2098
2099
#ifndef _LIBCPP_CXX03_LANG
2100
2101
template <class _CharT, class _Traits, class _Allocator>
2102
inline
2103
basic_string<_CharT, _Traits, _Allocator>::basic_string(
2104
    initializer_list<_CharT> __il)
2105
     : __r_(__default_init_tag(), __default_init_tag())
2106
{
2107
    __init(__il.begin(), __il.end());
2108
#if _LIBCPP_DEBUG_LEVEL >= 2
2109
    __get_db()->__insert_c(this);
2110
#endif
2111
}
2112
2113
template <class _CharT, class _Traits, class _Allocator>
2114
inline
2115
2116
basic_string<_CharT, _Traits, _Allocator>::basic_string(
2117
    initializer_list<_CharT> __il, const _Allocator& __a)
2118
    : __r_(__default_init_tag(), __a)
2119
{
2120
    __init(__il.begin(), __il.end());
2121
#if _LIBCPP_DEBUG_LEVEL >= 2
2122
    __get_db()->__insert_c(this);
2123
#endif
2124
}
2125
2126
#endif  // _LIBCPP_CXX03_LANG
2127
2128
template <class _CharT, class _Traits, class _Allocator>
2129
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
2130
1.79G
{
2131
#if _LIBCPP_DEBUG_LEVEL >= 2
2132
    __get_db()->__erase_c(this);
2133
#endif
2134
1.79G
    if (__is_long())
2135
310M
        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
2136
1.79G
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()
Line
Count
Source
2130
1.79G
{
2131
#if _LIBCPP_DEBUG_LEVEL >= 2
2132
    __get_db()->__erase_c(this);
2133
#endif
2134
1.79G
    if (__is_long())
2135
310M
        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
2136
1.79G
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::~basic_string()
Line
Count
Source
2130
223
{
2131
#if _LIBCPP_DEBUG_LEVEL >= 2
2132
    __get_db()->__erase_c(this);
2133
#endif
2134
223
    if (__is_long())
2135
67
        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
2136
223
}
2137
2138
template <class _CharT, class _Traits, class _Allocator>
2139
void
2140
basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
2141
    (size_type __old_cap, size_type __delta_cap, size_type __old_sz,
2142
     size_type __n_copy,  size_type __n_del,     size_type __n_add, const value_type* __p_new_stuff)
2143
20.7M
{
2144
20.7M
    size_type __ms = max_size();
2145
20.7M
    if (__delta_cap > __ms - __old_cap - 1)
2146
0
        this->__throw_length_error();
2147
20.7M
    pointer __old_p = __get_pointer();
2148
20.7M
    size_type __cap = __old_cap < __ms / 2 - __alignment ?
2149
20.7M
                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2150
18.4E
                          __ms - 1;
2151
20.7M
    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2152
20.7M
    __invalidate_all_iterators();
2153
20.7M
    if (__n_copy != 0)
2154
12.7M
        traits_type::copy(_VSTD::__to_address(__p),
2155
12.7M
                          _VSTD::__to_address(__old_p), __n_copy);
2156
20.7M
    if (__n_add != 0)
2157
20.7M
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
2158
20.7M
    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2159
20.7M
    if (__sec_cp_sz != 0)
2160
16.2k
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2161
16.2k
                          _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2162
20.7M
    if (__old_cap+1 != __min_cap)
2163
5.91M
        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2164
20.7M
    __set_long_pointer(__p);
2165
20.7M
    __set_long_cap(__cap+1);
2166
20.7M
    __old_sz = __n_copy + __n_add + __sec_cp_sz;
2167
20.7M
    __set_long_size(__old_sz);
2168
20.7M
    traits_type::assign(__p[__old_sz], value_type());
2169
20.7M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, char const*)
Line
Count
Source
2143
20.7M
{
2144
20.7M
    size_type __ms = max_size();
2145
20.7M
    if (__delta_cap > __ms - __old_cap - 1)
2146
0
        this->__throw_length_error();
2147
20.7M
    pointer __old_p = __get_pointer();
2148
20.7M
    size_type __cap = __old_cap < __ms / 2 - __alignment ?
2149
20.7M
                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2150
18.4E
                          __ms - 1;
2151
20.7M
    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2152
20.7M
    __invalidate_all_iterators();
2153
20.7M
    if (__n_copy != 0)
2154
12.7M
        traits_type::copy(_VSTD::__to_address(__p),
2155
12.7M
                          _VSTD::__to_address(__old_p), __n_copy);
2156
20.7M
    if (__n_add != 0)
2157
20.7M
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy, __p_new_stuff, __n_add);
2158
20.7M
    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2159
20.7M
    if (__sec_cp_sz != 0)
2160
16.2k
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2161
16.2k
                          _VSTD::__to_address(__old_p) + __n_copy + __n_del, __sec_cp_sz);
2162
20.7M
    if (__old_cap+1 != __min_cap)
2163
5.91M
        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2164
20.7M
    __set_long_pointer(__p);
2165
20.7M
    __set_long_cap(__cap+1);
2166
20.7M
    __old_sz = __n_copy + __n_add + __sec_cp_sz;
2167
20.7M
    __set_long_size(__old_sz);
2168
20.7M
    traits_type::assign(__p[__old_sz], value_type());
2169
20.7M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, wchar_t const*)
2170
2171
template <class _CharT, class _Traits, class _Allocator>
2172
void
2173
basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
2174
                                                     size_type __n_copy,  size_type __n_del,     size_type __n_add)
2175
12.2M
{
2176
12.2M
    size_type __ms = max_size();
2177
12.2M
    if (__delta_cap > __ms - __old_cap)
2178
0
        this->__throw_length_error();
2179
12.2M
    pointer __old_p = __get_pointer();
2180
12.2M
    size_type __cap = __old_cap < __ms / 2 - __alignment ?
2181
12.2M
                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2182
12.2M
                          
__ms - 10
;
2183
12.2M
    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2184
12.2M
    __invalidate_all_iterators();
2185
12.2M
    if (__n_copy != 0)
2186
12.2M
        traits_type::copy(_VSTD::__to_address(__p),
2187
12.2M
                          _VSTD::__to_address(__old_p), __n_copy);
2188
12.2M
    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2189
12.2M
    if (__sec_cp_sz != 0)
2190
1
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2191
1
                          _VSTD::__to_address(__old_p) + __n_copy + __n_del,
2192
1
                          __sec_cp_sz);
2193
12.2M
    if (__old_cap+1 != __min_cap)
2194
4.36M
        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2195
12.2M
    __set_long_pointer(__p);
2196
12.2M
    __set_long_cap(__cap+1);
2197
12.2M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
Line
Count
Source
2175
12.2M
{
2176
12.2M
    size_type __ms = max_size();
2177
12.2M
    if (__delta_cap > __ms - __old_cap)
2178
0
        this->__throw_length_error();
2179
12.2M
    pointer __old_p = __get_pointer();
2180
12.2M
    size_type __cap = __old_cap < __ms / 2 - __alignment ?
2181
12.2M
                          __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2182
12.2M
                          
__ms - 10
;
2183
12.2M
    pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2184
12.2M
    __invalidate_all_iterators();
2185
12.2M
    if (__n_copy != 0)
2186
12.2M
        traits_type::copy(_VSTD::__to_address(__p),
2187
12.2M
                          _VSTD::__to_address(__old_p), __n_copy);
2188
12.2M
    size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2189
12.2M
    if (__sec_cp_sz != 0)
2190
1
        traits_type::copy(_VSTD::__to_address(__p) + __n_copy + __n_add,
2191
1
                          _VSTD::__to_address(__old_p) + __n_copy + __n_del,
2192
1
                          __sec_cp_sz);
2193
12.2M
    if (__old_cap+1 != __min_cap)
2194
4.36M
        __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2195
12.2M
    __set_long_pointer(__p);
2196
12.2M
    __set_long_cap(__cap+1);
2197
12.2M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
2198
2199
// assign
2200
2201
template <class _CharT, class _Traits, class _Allocator>
2202
basic_string<_CharT, _Traits, _Allocator>&
2203
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
2204
16.3M
{
2205
16.3M
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
2206
16.3M
    size_type __cap = capacity();
2207
16.3M
    if (__cap >= __n)
2208
8.30M
    {
2209
8.30M
        value_type* __p = _VSTD::__to_address(__get_pointer());
2210
8.30M
        traits_type::move(__p, __s, __n);
2211
8.30M
        traits_type::assign(__p[__n], value_type());
2212
8.30M
        __set_size(__n);
2213
8.30M
        __invalidate_iterators_past(__n);
2214
8.30M
    }
2215
7.99M
    else
2216
7.99M
    {
2217
7.99M
        size_type __sz = size();
2218
7.99M
        __grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s);
2219
7.99M
    }
2220
16.3M
    return *this;
2221
16.3M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*, unsigned long)
Line
Count
Source
2204
16.3M
{
2205
16.3M
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr");
2206
16.3M
    size_type __cap = capacity();
2207
16.3M
    if (__cap >= __n)
2208
8.30M
    {
2209
8.30M
        value_type* __p = _VSTD::__to_address(__get_pointer());
2210
8.30M
        traits_type::move(__p, __s, __n);
2211
8.30M
        traits_type::assign(__p[__n], value_type());
2212
8.30M
        __set_size(__n);
2213
8.30M
        __invalidate_iterators_past(__n);
2214
8.30M
    }
2215
7.99M
    else
2216
7.99M
    {
2217
7.99M
        size_type __sz = size();
2218
7.99M
        __grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s);
2219
7.99M
    }
2220
16.3M
    return *this;
2221
16.3M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::assign(wchar_t const*, unsigned long)
2222
2223
template <class _CharT, class _Traits, class _Allocator>
2224
basic_string<_CharT, _Traits, _Allocator>&
2225
basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
2226
0
{
2227
0
    size_type __cap = capacity();
2228
0
    if (__cap < __n)
2229
0
    {
2230
0
        size_type __sz = size();
2231
0
        __grow_by(__cap, __n - __cap, __sz, 0, __sz);
2232
0
    }
2233
0
    else
2234
0
        __invalidate_iterators_past(__n);
2235
0
    value_type* __p = _VSTD::__to_address(__get_pointer());
2236
0
    traits_type::assign(__p, __n, __c);
2237
0
    traits_type::assign(__p[__n], value_type());
2238
0
    __set_size(__n);
2239
0
    return *this;
2240
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(unsigned long, char)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::assign(unsigned long, wchar_t)
2241
2242
template <class _CharT, class _Traits, class _Allocator>
2243
basic_string<_CharT, _Traits, _Allocator>&
2244
basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
2245
0
{
2246
0
    pointer __p;
2247
0
    if (__is_long())
2248
0
    {
2249
0
        __p = __get_long_pointer();
2250
0
        __set_long_size(1);
2251
0
    }
2252
0
    else
2253
0
    {
2254
0
        __p = __get_short_pointer();
2255
0
        __set_short_size(1);
2256
0
    }
2257
0
    traits_type::assign(*__p, __c);
2258
0
    traits_type::assign(*++__p, value_type());
2259
0
    __invalidate_iterators_past(1);
2260
0
    return *this;
2261
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(char)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator=(wchar_t)
2262
2263
template <class _CharT, class _Traits, class _Allocator>
2264
basic_string<_CharT, _Traits, _Allocator>&
2265
basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
2266
337k
{
2267
337k
    if (this != &__str)
2268
337k
    {
2269
337k
        __copy_assign_alloc(__str);
2270
337k
        const bool __str_is_long = __str.__is_long(); // Force single branch
2271
337k
        if (__is_long() || 
__str_is_long332k
) {
2272
32.8k
          return assign(__str.data(), __str.size());
2273
32.8k
        }
2274
304k
        __r_.first().__r = __str.__r_.first().__r;
2275
304k
    }
2276
337k
    
return *this304k
;
2277
337k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
2266
337k
{
2267
337k
    if (this != &__str)
2268
337k
    {
2269
337k
        __copy_assign_alloc(__str);
2270
337k
        const bool __str_is_long = __str.__is_long(); // Force single branch
2271
337k
        if (__is_long() || 
__str_is_long332k
) {
2272
32.8k
          return assign(__str.data(), __str.size());
2273
32.8k
        }
2274
304k
        __r_.first().__r = __str.__r_.first().__r;
2275
304k
    }
2276
337k
    
return *this304k
;
2277
337k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator=(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
2278
2279
#ifndef _LIBCPP_CXX03_LANG
2280
2281
template <class _CharT, class _Traits, class _Allocator>
2282
inline
2283
void
2284
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
2285
    _NOEXCEPT_(__alloc_traits::is_always_equal::value)
2286
{
2287
    if (__alloc() != __str.__alloc())
2288
        assign(__str);
2289
    else
2290
        __move_assign(__str, true_type());
2291
}
2292
2293
template <class _CharT, class _Traits, class _Allocator>
2294
inline
2295
void
2296
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
2297
#if _LIBCPP_STD_VER > 14
2298
    _NOEXCEPT
2299
#else
2300
    _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
2301
#endif
2302
85.7M
{
2303
85.7M
  if (__is_long()) {
2304
2.78M
    __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
2305
2.78M
                               __get_long_cap());
2306
2.78M
#if _LIBCPP_STD_VER <= 14
2307
2.78M
    if (!is_nothrow_move_assignable<allocator_type>::value) {
2308
0
      __set_short_size(0);
2309
0
      traits_type::assign(__get_short_pointer()[0], value_type());
2310
0
    }
2311
2.78M
#endif
2312
2.78M
  }
2313
85.7M
  __move_assign_alloc(__str);
2314
85.7M
  __r_.first() = __str.__r_.first();
2315
85.7M
  __str.__set_short_size(0);
2316
85.7M
  traits_type::assign(__str.__get_short_pointer()[0], value_type());
2317
85.7M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::integral_constant<bool, true>)
Line
Count
Source
2302
85.7M
{
2303
85.7M
  if (__is_long()) {
2304
2.78M
    __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
2305
2.78M
                               __get_long_cap());
2306
2.78M
#if _LIBCPP_STD_VER <= 14
2307
2.78M
    if (!is_nothrow_move_assignable<allocator_type>::value) {
2308
0
      __set_short_size(0);
2309
0
      traits_type::assign(__get_short_pointer()[0], value_type());
2310
0
    }
2311
2.78M
#endif
2312
2.78M
  }
2313
85.7M
  __move_assign_alloc(__str);
2314
85.7M
  __r_.first() = __str.__r_.first();
2315
85.7M
  __str.__set_short_size(0);
2316
85.7M
  traits_type::assign(__str.__get_short_pointer()[0], value_type());
2317
85.7M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__move_assign(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&, std::__1::integral_constant<bool, true>)
Line
Count
Source
2302
5
{
2303
5
  if (__is_long()) {
2304
2
    __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
2305
2
                               __get_long_cap());
2306
2
#if _LIBCPP_STD_VER <= 14
2307
2
    if (!is_nothrow_move_assignable<allocator_type>::value) {
2308
0
      __set_short_size(0);
2309
0
      traits_type::assign(__get_short_pointer()[0], value_type());
2310
0
    }
2311
2
#endif
2312
2
  }
2313
5
  __move_assign_alloc(__str);
2314
5
  __r_.first() = __str.__r_.first();
2315
5
  __str.__set_short_size(0);
2316
5
  traits_type::assign(__str.__get_short_pointer()[0], value_type());
2317
5
}
2318
2319
template <class _CharT, class _Traits, class _Allocator>
2320
inline
2321
basic_string<_CharT, _Traits, _Allocator>&
2322
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
2323
    _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
2324
85.7M
{
2325
85.7M
    __move_assign(__str, integral_constant<bool,
2326
85.7M
          __alloc_traits::propagate_on_container_move_assignment::value>());
2327
85.7M
    return *this;
2328
85.7M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Line
Count
Source
2324
85.7M
{
2325
85.7M
    __move_assign(__str, integral_constant<bool,
2326
85.7M
          __alloc_traits::propagate_on_container_move_assignment::value>());
2327
85.7M
    return *this;
2328
85.7M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator=(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >&&)
Line
Count
Source
2324
5
{
2325
5
    __move_assign(__str, integral_constant<bool,
2326
5
          __alloc_traits::propagate_on_container_move_assignment::value>());
2327
5
    return *this;
2328
5
}
2329
2330
#endif
2331
2332
template <class _CharT, class _Traits, class _Allocator>
2333
template<class _InputIterator>
2334
_EnableIf
2335
<
2336
     __is_exactly_cpp17_input_iterator <_InputIterator>::value
2337
          || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
2338
    basic_string<_CharT, _Traits, _Allocator>&
2339
>
2340
basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
2341
{
2342
    const basic_string __temp(__first, __last, __alloc());
2343
    assign(__temp.data(), __temp.size());
2344
    return *this;
2345
}
2346
2347
template <class _CharT, class _Traits, class _Allocator>
2348
template<class _ForwardIterator>
2349
_EnableIf
2350
<
2351
    __is_cpp17_forward_iterator<_ForwardIterator>::value
2352
         && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
2353
    basic_string<_CharT, _Traits, _Allocator>&
2354
>
2355
basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
2356
0
{
2357
0
    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2358
0
    size_type __cap = capacity();
2359
0
    if (__cap < __n)
2360
0
    {
2361
0
        size_type __sz = size();
2362
0
        __grow_by(__cap, __n - __cap, __sz, 0, __sz);
2363
0
    }
2364
0
    else
2365
0
        __invalidate_iterators_past(__n);
2366
0
    pointer __p = __get_pointer();
2367
0
    for (; __first != __last; ++__first, ++__p)
2368
0
        traits_type::assign(*__p, *__first);
2369
0
    traits_type::assign(*__p, value_type());
2370
0
    __set_size(__n);
2371
0
    return *this;
2372
0
}
2373
2374
template <class _CharT, class _Traits, class _Allocator>
2375
basic_string<_CharT, _Traits, _Allocator>&
2376
basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
2377
0
{
2378
0
    size_type __sz = __str.size();
2379
0
    if (__pos > __sz)
2380
0
        this->__throw_out_of_range();
2381
0
    return assign(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
2382
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::assign(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long)
2383
2384
template <class _CharT, class _Traits, class _Allocator>
2385
template <class _Tp>
2386
_EnableIf
2387
<
2388
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
2389
    && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
2390
    basic_string<_CharT, _Traits, _Allocator>&
2391
>
2392
basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __pos, size_type __n)
2393
{
2394
    __self_view __sv = __t;
2395
    size_type __sz = __sv.size();
2396
    if (__pos > __sz)
2397
        this->__throw_out_of_range();
2398
    return assign(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos));
2399
}
2400
2401
2402
template <class _CharT, class _Traits, class _Allocator>
2403
basic_string<_CharT, _Traits, _Allocator>&
2404
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
2405
16.2M
{
2406
16.2M
    _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
2407
16.2M
    return assign(__s, traits_type::length(__s));
2408
16.2M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)
Line
Count
Source
2405
16.2M
{
2406
16.2M
    _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr");
2407
16.2M
    return assign(__s, traits_type::length(__s));
2408
16.2M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::assign(wchar_t const*)
2409
2410
// append
2411
2412
template <class _CharT, class _Traits, class _Allocator>
2413
basic_string<_CharT, _Traits, _Allocator>&
2414
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
2415
38.7M
{
2416
38.7M
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr");
2417
38.7M
    size_type __cap = capacity();
2418
38.7M
    size_type __sz = size();
2419
38.7M
    if (__cap - __sz >= __n)
2420
26.0M
    {
2421
26.0M
        if (__n)
2422
25.8M
        {
2423
25.8M
            value_type* __p = _VSTD::__to_address(__get_pointer());
2424
25.8M
            traits_type::copy(__p + __sz, __s, __n);
2425
25.8M
            __sz += __n;
2426
25.8M
            __set_size(__sz);
2427
25.8M
            traits_type::assign(__p[__sz], value_type());
2428
25.8M
        }
2429
26.0M
    }
2430
12.7M
    else
2431
12.7M
        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
2432
38.7M
    return *this;
2433
38.7M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)
Line
Count
Source
2415
38.7M
{
2416
38.7M
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr");
2417
38.7M
    size_type __cap = capacity();
2418
38.7M
    size_type __sz = size();
2419
38.7M
    if (__cap - __sz >= __n)
2420
26.0M
    {
2421
26.0M
        if (__n)
2422
25.8M
        {
2423
25.8M
            value_type* __p = _VSTD::__to_address(__get_pointer());
2424
25.8M
            traits_type::copy(__p + __sz, __s, __n);
2425
25.8M
            __sz += __n;
2426
25.8M
            __set_size(__sz);
2427
25.8M
            traits_type::assign(__p[__sz], value_type());
2428
25.8M
        }
2429
26.0M
    }
2430
12.7M
    else
2431
12.7M
        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
2432
38.7M
    return *this;
2433
38.7M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append(wchar_t const*, unsigned long)
2434
2435
template <class _CharT, class _Traits, class _Allocator>
2436
basic_string<_CharT, _Traits, _Allocator>&
2437
basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
2438
29.4M
{
2439
29.4M
    if (__n)
2440
29.3M
    {
2441
29.3M
        size_type __cap = capacity();
2442
29.3M
        size_type __sz = size();
2443
29.3M
        if (__cap - __sz < __n)
2444
854
            __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2445
29.3M
        pointer __p = __get_pointer();
2446
29.3M
        traits_type::assign(_VSTD::__to_address(__p) + __sz, __n, __c);
2447
29.3M
        __sz += __n;
2448
29.3M
        __set_size(__sz);
2449
29.3M
        traits_type::assign(__p[__sz], value_type());
2450
29.3M
    }
2451
29.4M
    return *this;
2452
29.4M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(unsigned long, char)
Line
Count
Source
2438
29.4M
{
2439
29.4M
    if (__n)
2440
29.3M
    {
2441
29.3M
        size_type __cap = capacity();
2442
29.3M
        size_type __sz = size();
2443
29.3M
        if (__cap - __sz < __n)
2444
854
            __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2445
29.3M
        pointer __p = __get_pointer();
2446
29.3M
        traits_type::assign(_VSTD::__to_address(__p) + __sz, __n, __c);
2447
29.3M
        __sz += __n;
2448
29.3M
        __set_size(__sz);
2449
29.3M
        traits_type::assign(__p[__sz], value_type());
2450
29.3M
    }
2451
29.4M
    return *this;
2452
29.4M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append(unsigned long, wchar_t)
2453
2454
template <class _CharT, class _Traits, class _Allocator>
2455
inline void
2456
basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n)
2457
0
{
2458
0
    if (__n)
2459
0
    {
2460
0
        size_type __cap = capacity();
2461
0
        size_type __sz = size();
2462
0
        if (__cap - __sz < __n)
2463
0
            __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2464
0
        pointer __p = __get_pointer();
2465
0
        __sz += __n;
2466
0
        __set_size(__sz);
2467
0
        traits_type::assign(__p[__sz], value_type());
2468
0
    }
2469
0
}
2470
2471
template <class _CharT, class _Traits, class _Allocator>
2472
void
2473
basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
2474
205M
{
2475
205M
    bool __is_short = !__is_long();
2476
205M
    size_type __cap;
2477
205M
    size_type __sz;
2478
205M
    if (__is_short)
2479
32.1M
    {
2480
32.1M
        __cap = __min_cap - 1;
2481
32.1M
        __sz = __get_short_size();
2482
32.1M
    }
2483
173M
    else
2484
173M
    {
2485
173M
        __cap = __get_long_cap() - 1;
2486
173M
        __sz = __get_long_size();
2487
173M
    }
2488
205M
    if (__sz == __cap)
2489
12.2M
    {
2490
12.2M
        __grow_by(__cap, 1, __sz, __sz, 0);
2491
12.2M
        __is_short = !__is_long();
2492
12.2M
    }
2493
205M
    pointer __p;
2494
205M
    if (__is_short)
2495
24.3M
    {
2496
24.3M
        __p = __get_short_pointer() + __sz;
2497
24.3M
        __set_short_size(__sz+1);
2498
24.3M
    }
2499
181M
    else
2500
181M
    {
2501
181M
        __p = __get_long_pointer() + __sz;
2502
181M
        __set_long_size(__sz+1);
2503
181M
    }
2504
205M
    traits_type::assign(*__p, __c);
2505
205M
    traits_type::assign(*++__p, value_type());
2506
205M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)
Line
Count
Source
2474
205M
{
2475
205M
    bool __is_short = !__is_long();
2476
205M
    size_type __cap;
2477
205M
    size_type __sz;
2478
205M
    if (__is_short)
2479
32.1M
    {
2480
32.1M
        __cap = __min_cap - 1;
2481
32.1M
        __sz = __get_short_size();
2482
32.1M
    }
2483
173M
    else
2484
173M
    {
2485
173M
        __cap = __get_long_cap() - 1;
2486
173M
        __sz = __get_long_size();
2487
173M
    }
2488
205M
    if (__sz == __cap)
2489
12.2M
    {
2490
12.2M
        __grow_by(__cap, 1, __sz, __sz, 0);
2491
12.2M
        __is_short = !__is_long();
2492
12.2M
    }
2493
205M
    pointer __p;
2494
205M
    if (__is_short)
2495
24.3M
    {
2496
24.3M
        __p = __get_short_pointer() + __sz;
2497
24.3M
        __set_short_size(__sz+1);
2498
24.3M
    }
2499
181M
    else
2500
181M
    {
2501
181M
        __p = __get_long_pointer() + __sz;
2502
181M
        __set_long_size(__sz+1);
2503
181M
    }
2504
205M
    traits_type::assign(*__p, __c);
2505
205M
    traits_type::assign(*++__p, value_type());
2506
205M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::push_back(wchar_t)
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::push_back(char16_t)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::push_back(char32_t)
2507
2508
template <class _Tp>
2509
bool __ptr_in_range (const _Tp* __p, const _Tp* __first, const _Tp* __last)
2510
1.06k
{
2511
1.06k
    return __first <= __p && 
__p < __last260
;
2512
1.06k
}
bool std::__1::__ptr_in_range<char>(char const*, char const*, char const*)
Line
Count
Source
2510
1.06k
{
2511
1.06k
    return __first <= __p && 
__p < __last260
;
2512
1.06k
}
Unexecuted instantiation: bool std::__1::__ptr_in_range<wchar_t>(wchar_t const*, wchar_t const*, wchar_t const*)
2513
2514
template <class _Tp1, class _Tp2>
2515
bool __ptr_in_range (const _Tp1*, const _Tp2*, const _Tp2*)
2516
{
2517
    return false;
2518
}
2519
2520
template <class _CharT, class _Traits, class _Allocator>
2521
template<class _ForwardIterator>
2522
basic_string<_CharT, _Traits, _Allocator>&
2523
basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
2524
    _ForwardIterator __first, _ForwardIterator __last)
2525
850
{
2526
850
    static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2527
850
                  "function requires a ForwardIterator");
2528
850
    size_type __sz = size();
2529
850
    size_type __cap = capacity();
2530
850
    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2531
850
    if (__n)
2532
850
    {
2533
850
        typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
2534
850
        _CharRef __tmp_ref = *__first;
2535
850
        if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size()))
2536
0
        {
2537
0
            const basic_string __temp (__first, __last, __alloc());
2538
0
            append(__temp.data(), __temp.size());
2539
0
        }
2540
850
        else
2541
850
        {
2542
850
            if (__cap - __sz < __n)
2543
735
                __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2544
850
            pointer __p = __get_pointer() + __sz;
2545
23.1k
            for (; __first != __last; 
++__p, ++__first22.3k
)
2546
22.3k
                traits_type::assign(*__p, *__first);
2547
850
            traits_type::assign(*__p, value_type());
2548
850
            __set_size(__sz + __n);
2549
850
        }
2550
850
    }
2551
850
    return *this;
2552
850
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >& std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__append_forward_unsafe<char*>(char*, char*)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >& std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__append_forward_unsafe<wchar_t*>(wchar_t*, wchar_t*)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >& std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__append_forward_unsafe<char const*>(char const*, char const*)
Line
Count
Source
2525
850
{
2526
850
    static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
2527
850
                  "function requires a ForwardIterator");
2528
850
    size_type __sz = size();
2529
850
    size_type __cap = capacity();
2530
850
    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2531
850
    if (__n)
2532
850
    {
2533
850
        typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
2534
850
        _CharRef __tmp_ref = *__first;
2535
850
        if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size()))
2536
0
        {
2537
0
            const basic_string __temp (__first, __last, __alloc());
2538
0
            append(__temp.data(), __temp.size());
2539
0
        }
2540
850
        else
2541
850
        {
2542
850
            if (__cap - __sz < __n)
2543
735
                __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2544
850
            pointer __p = __get_pointer() + __sz;
2545
23.1k
            for (; __first != __last; 
++__p, ++__first22.3k
)
2546
22.3k
                traits_type::assign(*__p, *__first);
2547
850
            traits_type::assign(*__p, value_type());
2548
850
            __set_size(__sz + __n);
2549
850
        }
2550
850
    }
2551
850
    return *this;
2552
850
}
2553
2554
template <class _CharT, class _Traits, class _Allocator>
2555
inline
2556
basic_string<_CharT, _Traits, _Allocator>&
2557
basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str)
2558
29.5M
{
2559
29.5M
    return append(__str.data(), __str.size());
2560
29.5M
}
2561
2562
template <class _CharT, class _Traits, class _Allocator>
2563
basic_string<_CharT, _Traits, _Allocator>&
2564
basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
2565
0
{
2566
0
    size_type __sz = __str.size();
2567
0
    if (__pos > __sz)
2568
0
        this->__throw_out_of_range();
2569
0
    return append(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
2570
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long)
2571
2572
template <class _CharT, class _Traits, class _Allocator>
2573
template <class _Tp>
2574
    _EnableIf
2575
    <
2576
        __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
2577
        basic_string<_CharT, _Traits, _Allocator>&
2578
    >
2579
basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __pos, size_type __n)
2580
{
2581
    __self_view __sv = __t;
2582
    size_type __sz = __sv.size();
2583
    if (__pos > __sz)
2584
        this->__throw_out_of_range();
2585
    return append(__sv.data() + __pos, _VSTD::min(__n, __sz - __pos));
2586
}
2587
2588
template <class _CharT, class _Traits, class _Allocator>
2589
basic_string<_CharT, _Traits, _Allocator>&
2590
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
2591
27.7M
{
2592
27.7M
    _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr");
2593
27.7M
    return append(__s, traits_type::length(__s));
2594
27.7M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)
Line
Count
Source
2591
27.7M
{
2592
27.7M
    _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr");
2593
27.7M
    return append(__s, traits_type::length(__s));
2594
27.7M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append(wchar_t const*)
2595
2596
// insert
2597
2598
template <class _CharT, class _Traits, class _Allocator>
2599
basic_string<_CharT, _Traits, _Allocator>&
2600
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
2601
114k
{
2602
114k
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr");
2603
114k
    size_type __sz = size();
2604
114k
    if (__pos > __sz)
2605
0
        this->__throw_out_of_range();
2606
114k
    size_type __cap = capacity();
2607
114k
    if (__cap - __sz >= __n)
2608
98.0k
    {
2609
98.0k
        if (__n)
2610
98.0k
        {
2611
98.0k
            value_type* __p = _VSTD::__to_address(__get_pointer());
2612
98.0k
            size_type __n_move = __sz - __pos;
2613
98.0k
            if (__n_move != 0)
2614
98.0k
            {
2615
98.0k
                if (__p + __pos <= __s && 
__s < __p + __sz0
)
2616
0
                    __s += __n;
2617
98.0k
                traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
2618
98.0k
            }
2619
98.0k
            traits_type::move(__p + __pos, __s, __n);
2620
98.0k
            __sz += __n;
2621
98.0k
            __set_size(__sz);
2622
98.0k
            traits_type::assign(__p[__sz], value_type());
2623
98.0k
        }
2624
98.0k
    }
2625
16.2k
    else
2626
16.2k
        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
2627
114k
    return *this;
2628
114k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, char const*, unsigned long)
Line
Count
Source
2601
114k
{
2602
114k
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr");
2603
114k
    size_type __sz = size();
2604
114k
    if (__pos > __sz)
2605
0
        this->__throw_out_of_range();
2606
114k
    size_type __cap = capacity();
2607
114k
    if (__cap - __sz >= __n)
2608
98.0k
    {
2609
98.0k
        if (__n)
2610
98.0k
        {
2611
98.0k
            value_type* __p = _VSTD::__to_address(__get_pointer());
2612
98.0k
            size_type __n_move = __sz - __pos;
2613
98.0k
            if (__n_move != 0)
2614
98.0k
            {
2615
98.0k
                if (__p + __pos <= __s && 
__s < __p + __sz0
)
2616
0
                    __s += __n;
2617
98.0k
                traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
2618
98.0k
            }
2619
98.0k
            traits_type::move(__p + __pos, __s, __n);
2620
98.0k
            __sz += __n;
2621
98.0k
            __set_size(__sz);
2622
98.0k
            traits_type::assign(__p[__sz], value_type());
2623
98.0k
        }
2624
98.0k
    }
2625
16.2k
    else
2626
16.2k
        __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
2627
114k
    return *this;
2628
114k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(unsigned long, wchar_t const*, unsigned long)
2629
2630
template <class _CharT, class _Traits, class _Allocator>
2631
basic_string<_CharT, _Traits, _Allocator>&
2632
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
2633
0
{
2634
0
    size_type __sz = size();
2635
0
    if (__pos > __sz)
2636
0
        this->__throw_out_of_range();
2637
0
    if (__n)
2638
0
    {
2639
0
        size_type __cap = capacity();
2640
0
        value_type* __p;
2641
0
        if (__cap - __sz >= __n)
2642
0
        {
2643
0
            __p = _VSTD::__to_address(__get_pointer());
2644
0
            size_type __n_move = __sz - __pos;
2645
0
            if (__n_move != 0)
2646
0
                traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
2647
0
        }
2648
0
        else
2649
0
        {
2650
0
            __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
2651
0
            __p = _VSTD::__to_address(__get_long_pointer());
2652
0
        }
2653
0
        traits_type::assign(__p + __pos, __n, __c);
2654
0
        __sz += __n;
2655
0
        __set_size(__sz);
2656
0
        traits_type::assign(__p[__sz], value_type());
2657
0
    }
2658
0
    return *this;
2659
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, unsigned long, char)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(unsigned long, unsigned long, wchar_t)
2660
2661
template <class _CharT, class _Traits, class _Allocator>
2662
template<class _InputIterator>
2663
_EnableIf
2664
<
2665
   __is_exactly_cpp17_input_iterator<_InputIterator>::value
2666
        || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
2667
   typename basic_string<_CharT, _Traits, _Allocator>::iterator
2668
>
2669
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
2670
{
2671
#if _LIBCPP_DEBUG_LEVEL >= 2
2672
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
2673
        "string::insert(iterator, range) called with an iterator not"
2674
        " referring to this string");
2675
#endif
2676
    const basic_string __temp(__first, __last, __alloc());
2677
    return insert(__pos, __temp.data(), __temp.data() + __temp.size());
2678
}
2679
2680
template <class _CharT, class _Traits, class _Allocator>
2681
template<class _ForwardIterator>
2682
_EnableIf
2683
<
2684
    __is_cpp17_forward_iterator<_ForwardIterator>::value
2685
        && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
2686
    typename basic_string<_CharT, _Traits, _Allocator>::iterator
2687
>
2688
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
2689
{
2690
#if _LIBCPP_DEBUG_LEVEL >= 2
2691
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
2692
        "string::insert(iterator, range) called with an iterator not"
2693
        " referring to this string");
2694
#endif
2695
    size_type __ip = static_cast<size_type>(__pos - begin());
2696
    size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2697
    if (__n)
2698
    {
2699
        typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
2700
        _CharRef __tmp_char = *__first;
2701
        if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size()))
2702
        {
2703
            const basic_string __temp(__first, __last, __alloc());
2704
            return insert(__pos, __temp.data(), __temp.data() + __temp.size());
2705
        }
2706
2707
        size_type __sz = size();
2708
        size_type __cap = capacity();
2709
        value_type* __p;
2710
        if (__cap - __sz >= __n)
2711
        {
2712
            __p = _VSTD::__to_address(__get_pointer());
2713
            size_type __n_move = __sz - __ip;
2714
            if (__n_move != 0)
2715
                traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
2716
        }
2717
        else
2718
        {
2719
            __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
2720
            __p = _VSTD::__to_address(__get_long_pointer());
2721
        }
2722
        __sz += __n;
2723
        __set_size(__sz);
2724
        traits_type::assign(__p[__sz], value_type());
2725
        for (__p += __ip; __first != __last; ++__p, ++__first)
2726
            traits_type::assign(*__p, *__first);
2727
    }
2728
    return begin() + __ip;
2729
}
2730
2731
template <class _CharT, class _Traits, class _Allocator>
2732
inline
2733
basic_string<_CharT, _Traits, _Allocator>&
2734
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str)
2735
{
2736
    return insert(__pos1, __str.data(), __str.size());
2737
}
2738
2739
template <class _CharT, class _Traits, class _Allocator>
2740
basic_string<_CharT, _Traits, _Allocator>&
2741
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
2742
                                                  size_type __pos2, size_type __n)
2743
0
{
2744
0
    size_type __str_sz = __str.size();
2745
0
    if (__pos2 > __str_sz)
2746
0
        this->__throw_out_of_range();
2747
0
    return insert(__pos1, __str.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
2748
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(unsigned long, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long)
2749
2750
template <class _CharT, class _Traits, class _Allocator>
2751
template <class _Tp>
2752
_EnableIf
2753
<
2754
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value  && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
2755
    basic_string<_CharT, _Traits, _Allocator>&
2756
>
2757
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t,
2758
                                                  size_type __pos2, size_type __n)
2759
{
2760
    __self_view __sv = __t;
2761
    size_type __str_sz = __sv.size();
2762
    if (__pos2 > __str_sz)
2763
        this->__throw_out_of_range();
2764
    return insert(__pos1, __sv.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
2765
}
2766
2767
template <class _CharT, class _Traits, class _Allocator>
2768
basic_string<_CharT, _Traits, _Allocator>&
2769
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
2770
114k
{
2771
114k
    _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr");
2772
114k
    return insert(__pos, __s, traits_type::length(__s));
2773
114k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, char const*)
Line
Count
Source
2770
114k
{
2771
114k
    _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr");
2772
114k
    return insert(__pos, __s, traits_type::length(__s));
2773
114k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(unsigned long, wchar_t const*)
2774
2775
template <class _CharT, class _Traits, class _Allocator>
2776
typename basic_string<_CharT, _Traits, _Allocator>::iterator
2777
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
2778
21
{
2779
21
    size_type __ip = static_cast<size_type>(__pos - begin());
2780
21
    size_type __sz = size();
2781
21
    size_type __cap = capacity();
2782
21
    value_type* __p;
2783
21
    if (__cap == __sz)
2784
1
    {
2785
1
        __grow_by(__cap, 1, __sz, __ip, 0, 1);
2786
1
        __p = _VSTD::__to_address(__get_long_pointer());
2787
1
    }
2788
20
    else
2789
20
    {
2790
20
        __p = _VSTD::__to_address(__get_pointer());
2791
20
        size_type __n_move = __sz - __ip;
2792
20
        if (__n_move != 0)
2793
20
            traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
2794
20
    }
2795
21
    traits_type::assign(__p[__ip], __c);
2796
21
    traits_type::assign(__p[++__sz], value_type());
2797
21
    __set_size(__sz);
2798
21
    return begin() + static_cast<difference_type>(__ip);
2799
21
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(std::__1::__wrap_iter<char const*>, char)
Line
Count
Source
2778
21
{
2779
21
    size_type __ip = static_cast<size_type>(__pos - begin());
2780
21
    size_type __sz = size();
2781
21
    size_type __cap = capacity();
2782
21
    value_type* __p;
2783
21
    if (__cap == __sz)
2784
1
    {
2785
1
        __grow_by(__cap, 1, __sz, __ip, 0, 1);
2786
1
        __p = _VSTD::__to_address(__get_long_pointer());
2787
1
    }
2788
20
    else
2789
20
    {
2790
20
        __p = _VSTD::__to_address(__get_pointer());
2791
20
        size_type __n_move = __sz - __ip;
2792
20
        if (__n_move != 0)
2793
20
            traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
2794
20
    }
2795
21
    traits_type::assign(__p[__ip], __c);
2796
21
    traits_type::assign(__p[++__sz], value_type());
2797
21
    __set_size(__sz);
2798
21
    return begin() + static_cast<difference_type>(__ip);
2799
21
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(std::__1::__wrap_iter<wchar_t const*>, wchar_t)
2800
2801
template <class _CharT, class _Traits, class _Allocator>
2802
inline
2803
typename basic_string<_CharT, _Traits, _Allocator>::iterator
2804
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
2805
{
2806
#if _LIBCPP_DEBUG_LEVEL >= 2
2807
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
2808
        "string::insert(iterator, n, value) called with an iterator not"
2809
        " referring to this string");
2810
#endif
2811
    difference_type __p = __pos - begin();
2812
    insert(static_cast<size_type>(__p), __n, __c);
2813
    return begin() + __p;
2814
}
2815
2816
// replace
2817
2818
template <class _CharT, class _Traits, class _Allocator>
2819
basic_string<_CharT, _Traits, _Allocator>&
2820
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
2821
    _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2822
2
{
2823
2
    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
2824
2
    size_type __sz = size();
2825
2
    if (__pos > __sz)
2826
0
        this->__throw_out_of_range();
2827
2
    __n1 = _VSTD::min(__n1, __sz - __pos);
2828
2
    size_type __cap = capacity();
2829
2
    if (__cap - __sz + __n1 >= __n2)
2830
2
    {
2831
2
        value_type* __p = _VSTD::__to_address(__get_pointer());
2832
2
        if (__n1 != __n2)
2833
1
        {
2834
1
            size_type __n_move = __sz - __pos - __n1;
2835
1
            if (__n_move != 0)
2836
0
            {
2837
0
                if (__n1 > __n2)
2838
0
                {
2839
0
                    traits_type::move(__p + __pos, __s, __n2);
2840
0
                    traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2841
0
                    goto __finish;
2842
0
                }
2843
0
                if (__p + __pos < __s && __s < __p + __sz)
2844
0
                {
2845
0
                    if (__p + __pos + __n1 <= __s)
2846
0
                        __s += __n2 - __n1;
2847
0
                    else // __p + __pos < __s < __p + __pos + __n1
2848
0
                    {
2849
0
                        traits_type::move(__p + __pos, __s, __n1);
2850
0
                        __pos += __n1;
2851
0
                        __s += __n2;
2852
0
                        __n2 -= __n1;
2853
0
                        __n1 = 0;
2854
0
                    }
2855
0
                }
2856
0
                traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2857
0
            }
2858
1
        }
2859
2
        traits_type::move(__p + __pos, __s, __n2);
2860
2
__finish:
2861
2
// __sz += __n2 - __n1; in this and the below function below can cause unsigned
2862
2
// integer overflow, but this is a safe operation, so we disable the check.
2863
2
        __sz += __n2 - __n1;
2864
2
        __set_size(__sz);
2865
2
        __invalidate_iterators_past(__sz);
2866
2
        traits_type::assign(__p[__sz], value_type());
2867
2
    }
2868
0
    else
2869
0
        __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
2870
2
    return *this;
2871
2
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::replace(unsigned long, unsigned long, char const*, unsigned long)
Line
Count
Source
2822
2
{
2823
2
    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
2824
2
    size_type __sz = size();
2825
2
    if (__pos > __sz)
2826
0
        this->__throw_out_of_range();
2827
2
    __n1 = _VSTD::min(__n1, __sz - __pos);
2828
2
    size_type __cap = capacity();
2829
2
    if (__cap - __sz + __n1 >= __n2)
2830
2
    {
2831
2
        value_type* __p = _VSTD::__to_address(__get_pointer());
2832
2
        if (__n1 != __n2)
2833
1
        {
2834
1
            size_type __n_move = __sz - __pos - __n1;
2835
1
            if (__n_move != 0)
2836
0
            {
2837
0
                if (__n1 > __n2)
2838
0
                {
2839
0
                    traits_type::move(__p + __pos, __s, __n2);
2840
0
                    traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2841
0
                    goto __finish;
2842
0
                }
2843
0
                if (__p + __pos < __s && __s < __p + __sz)
2844
0
                {
2845
0
                    if (__p + __pos + __n1 <= __s)
2846
0
                        __s += __n2 - __n1;
2847
0
                    else // __p + __pos < __s < __p + __pos + __n1
2848
0
                    {
2849
0
                        traits_type::move(__p + __pos, __s, __n1);
2850
0
                        __pos += __n1;
2851
0
                        __s += __n2;
2852
0
                        __n2 -= __n1;
2853
0
                        __n1 = 0;
2854
0
                    }
2855
0
                }
2856
0
                traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2857
0
            }
2858
1
        }
2859
2
        traits_type::move(__p + __pos, __s, __n2);
2860
2
__finish:
2861
2
// __sz += __n2 - __n1; in this and the below function below can cause unsigned
2862
2
// integer overflow, but this is a safe operation, so we disable the check.
2863
2
        __sz += __n2 - __n1;
2864
2
        __set_size(__sz);
2865
2
        __invalidate_iterators_past(__sz);
2866
2
        traits_type::assign(__p[__sz], value_type());
2867
2
    }
2868
0
    else
2869
0
        __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
2870
2
    return *this;
2871
2
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::replace(unsigned long, unsigned long, wchar_t const*, unsigned long)
2872
2873
template <class _CharT, class _Traits, class _Allocator>
2874
basic_string<_CharT, _Traits, _Allocator>&
2875
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
2876
    _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2877
0
{
2878
0
    size_type __sz = size();
2879
0
    if (__pos > __sz)
2880
0
        this->__throw_out_of_range();
2881
0
    __n1 = _VSTD::min(__n1, __sz - __pos);
2882
0
    size_type __cap = capacity();
2883
0
    value_type* __p;
2884
0
    if (__cap - __sz + __n1 >= __n2)
2885
0
    {
2886
0
        __p = _VSTD::__to_address(__get_pointer());
2887
0
        if (__n1 != __n2)
2888
0
        {
2889
0
            size_type __n_move = __sz - __pos - __n1;
2890
0
            if (__n_move != 0)
2891
0
                traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2892
0
        }
2893
0
    }
2894
0
    else
2895
0
    {
2896
0
        __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
2897
0
        __p = _VSTD::__to_address(__get_long_pointer());
2898
0
    }
2899
0
    traits_type::assign(__p + __pos, __n2, __c);
2900
0
    __sz += __n2 - __n1;
2901
0
    __set_size(__sz);
2902
0
    __invalidate_iterators_past(__sz);
2903
0
    traits_type::assign(__p[__sz], value_type());
2904
0
    return *this;
2905
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::replace(unsigned long, unsigned long, unsigned long, char)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::replace(unsigned long, unsigned long, unsigned long, wchar_t)
2906
2907
template <class _CharT, class _Traits, class _Allocator>
2908
template<class _InputIterator>
2909
_EnableIf
2910
<
2911
    __is_cpp17_input_iterator<_InputIterator>::value,
2912
    basic_string<_CharT, _Traits, _Allocator>&
2913
>
2914
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
2915
                                                   _InputIterator __j1, _InputIterator __j2)
2916
{
2917
    const basic_string __temp(__j1, __j2, __alloc());
2918
    return this->replace(__i1, __i2, __temp);
2919
}
2920
2921
template <class _CharT, class _Traits, class _Allocator>
2922
inline
2923
basic_string<_CharT, _Traits, _Allocator>&
2924
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str)
2925
{
2926
    return replace(__pos1, __n1, __str.data(), __str.size());
2927
}
2928
2929
template <class _CharT, class _Traits, class _Allocator>
2930
basic_string<_CharT, _Traits, _Allocator>&
2931
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
2932
                                                   size_type __pos2, size_type __n2)
2933
0
{
2934
0
    size_type __str_sz = __str.size();
2935
0
    if (__pos2 > __str_sz)
2936
0
        this->__throw_out_of_range();
2937
0
    return replace(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
2938
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::replace(unsigned long, unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::replace(unsigned long, unsigned long, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long)
2939
2940
template <class _CharT, class _Traits, class _Allocator>
2941
template <class _Tp>
2942
_EnableIf
2943
<
2944
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
2945
    basic_string<_CharT, _Traits, _Allocator>&
2946
>
2947
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const _Tp& __t,
2948
                                                   size_type __pos2, size_type __n2)
2949
{
2950
    __self_view __sv = __t;
2951
    size_type __str_sz = __sv.size();
2952
    if (__pos2 > __str_sz)
2953
        this->__throw_out_of_range();
2954
    return replace(__pos1, __n1, __sv.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
2955
}
2956
2957
template <class _CharT, class _Traits, class _Allocator>
2958
basic_string<_CharT, _Traits, _Allocator>&
2959
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
2960
2
{
2961
2
    _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr");
2962
2
    return replace(__pos, __n1, __s, traits_type::length(__s));
2963
2
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::replace(unsigned long, unsigned long, char const*)
Line
Count
Source
2960
2
{
2961
2
    _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr");
2962
2
    return replace(__pos, __n1, __s, traits_type::length(__s));
2963
2
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::replace(unsigned long, unsigned long, wchar_t const*)
2964
2965
template <class _CharT, class _Traits, class _Allocator>
2966
inline
2967
basic_string<_CharT, _Traits, _Allocator>&
2968
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
2969
{
2970
    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
2971
                   __str.data(), __str.size());
2972
}
2973
2974
template <class _CharT, class _Traits, class _Allocator>
2975
inline
2976
basic_string<_CharT, _Traits, _Allocator>&
2977
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n)
2978
{
2979
    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
2980
}
2981
2982
template <class _CharT, class _Traits, class _Allocator>
2983
inline
2984
basic_string<_CharT, _Traits, _Allocator>&
2985
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s)
2986
{
2987
    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
2988
}
2989
2990
template <class _CharT, class _Traits, class _Allocator>
2991
inline
2992
basic_string<_CharT, _Traits, _Allocator>&
2993
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
2994
{
2995
    return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
2996
}
2997
2998
// erase
2999
3000
template <class _CharT, class _Traits, class _Allocator>
3001
basic_string<_CharT, _Traits, _Allocator>&
3002
basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
3003
17.0k
{
3004
17.0k
    size_type __sz = size();
3005
17.0k
    if (__pos > __sz)
3006
0
        this->__throw_out_of_range();
3007
17.0k
    if (__n)
3008
17.0k
    {
3009
17.0k
        value_type* __p = _VSTD::__to_address(__get_pointer());
3010
17.0k
        __n = _VSTD::min(__n, __sz - __pos);
3011
17.0k
        size_type __n_move = __sz - __pos - __n;
3012
17.0k
        if (__n_move != 0)
3013
28
            traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
3014
17.0k
        __sz -= __n;
3015
17.0k
        __set_size(__sz);
3016
17.0k
        __invalidate_iterators_past(__sz);
3017
17.0k
        traits_type::assign(__p[__sz], value_type());
3018
17.0k
    }
3019
17.0k
    return *this;
3020
17.0k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::erase(unsigned long, unsigned long)
Line
Count
Source
3003
17.0k
{
3004
17.0k
    size_type __sz = size();
3005
17.0k
    if (__pos > __sz)
3006
0
        this->__throw_out_of_range();
3007
17.0k
    if (__n)
3008
17.0k
    {
3009
17.0k
        value_type* __p = _VSTD::__to_address(__get_pointer());
3010
17.0k
        __n = _VSTD::min(__n, __sz - __pos);
3011
17.0k
        size_type __n_move = __sz - __pos - __n;
3012
17.0k
        if (__n_move != 0)
3013
28
            traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
3014
17.0k
        __sz -= __n;
3015
17.0k
        __set_size(__sz);
3016
17.0k
        __invalidate_iterators_past(__sz);
3017
17.0k
        traits_type::assign(__p[__sz], value_type());
3018
17.0k
    }
3019
17.0k
    return *this;
3020
17.0k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::erase(unsigned long, unsigned long)
3021
3022
template <class _CharT, class _Traits, class _Allocator>
3023
inline
3024
typename basic_string<_CharT, _Traits, _Allocator>::iterator
3025
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
3026
572k
{
3027
#if _LIBCPP_DEBUG_LEVEL >= 2
3028
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
3029
        "string::erase(iterator) called with an iterator not"
3030
        " referring to this string");
3031
#endif
3032
572k
    _LIBCPP_ASSERT(__pos != end(),
3033
572k
        "string::erase(iterator) called with a non-dereferenceable iterator");
3034
572k
    iterator __b = begin();
3035
572k
    size_type __r = static_cast<size_type>(__pos - __b);
3036
572k
    erase(__r, 1);
3037
572k
    return __b + static_cast<difference_type>(__r);
3038
572k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::erase(std::__1::__wrap_iter<char const*>)
Line
Count
Source
3026
572k
{
3027
#if _LIBCPP_DEBUG_LEVEL >= 2
3028
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
3029
        "string::erase(iterator) called with an iterator not"
3030
        " referring to this string");
3031
#endif
3032
572k
    _LIBCPP_ASSERT(__pos != end(),
3033
572k
        "string::erase(iterator) called with a non-dereferenceable iterator");
3034
572k
    iterator __b = begin();
3035
572k
    size_type __r = static_cast<size_type>(__pos - __b);
3036
572k
    erase(__r, 1);
3037
572k
    return __b + static_cast<difference_type>(__r);
3038
572k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::erase(std::__1::__wrap_iter<wchar_t const*>)
3039
3040
template <class _CharT, class _Traits, class _Allocator>
3041
inline
3042
typename basic_string<_CharT, _Traits, _Allocator>::iterator
3043
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
3044
{
3045
#if _LIBCPP_DEBUG_LEVEL >= 2
3046
    _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
3047
        "string::erase(iterator,  iterator) called with an iterator not"
3048
        " referring to this string");
3049
#endif
3050
    _LIBCPP_ASSERT(__first <= __last, "string::erase(first, last) called with invalid range");
3051
    iterator __b = begin();
3052
    size_type __r = static_cast<size_type>(__first - __b);
3053
    erase(__r, static_cast<size_type>(__last - __first));
3054
    return __b + static_cast<difference_type>(__r);
3055
}
3056
3057
template <class _CharT, class _Traits, class _Allocator>
3058
inline
3059
void
3060
basic_string<_CharT, _Traits, _Allocator>::pop_back()
3061
2.46k
{
3062
2.46k
    _LIBCPP_ASSERT(!empty(), "string::pop_back(): string is already empty");
3063
2.46k
    size_type __sz;
3064
2.46k
    if (__is_long())
3065
1.34k
    {
3066
1.34k
        __sz = __get_long_size() - 1;
3067
1.34k
        __set_long_size(__sz);
3068
1.34k
        traits_type::assign(*(__get_long_pointer() + __sz), value_type());
3069
1.34k
    }
3070
1.11k
    else
3071
1.11k
    {
3072
1.11k
        __sz = __get_short_size() - 1;
3073
1.11k
        __set_short_size(__sz);
3074
1.11k
        traits_type::assign(*(__get_short_pointer() + __sz), value_type());
3075
1.11k
    }
3076
2.46k
    __invalidate_iterators_past(__sz);
3077
2.46k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::pop_back()
Line
Count
Source
3061
2.46k
{
3062
2.46k
    _LIBCPP_ASSERT(!empty(), "string::pop_back(): string is already empty");
3063
2.46k
    size_type __sz;
3064
2.46k
    if (__is_long())
3065
1.34k
    {
3066
1.34k
        __sz = __get_long_size() - 1;
3067
1.34k
        __set_long_size(__sz);
3068
1.34k
        traits_type::assign(*(__get_long_pointer() + __sz), value_type());
3069
1.34k
    }
3070
1.11k
    else
3071
1.11k
    {
3072
1.11k
        __sz = __get_short_size() - 1;
3073
1.11k
        __set_short_size(__sz);
3074
1.11k
        traits_type::assign(*(__get_short_pointer() + __sz), value_type());
3075
1.11k
    }
3076
2.46k
    __invalidate_iterators_past(__sz);
3077
2.46k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::pop_back()
3078
3079
template <class _CharT, class _Traits, class _Allocator>
3080
inline
3081
void
3082
basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
3083
12.6M
{
3084
12.6M
    __invalidate_all_iterators();
3085
12.6M
    if (__is_long())
3086
203k
    {
3087
203k
        traits_type::assign(*__get_long_pointer(), value_type());
3088
203k
        __set_long_size(0);
3089
203k
    }
3090
12.4M
    else
3091
12.4M
    {
3092
12.4M
        traits_type::assign(*__get_short_pointer(), value_type());
3093
12.4M
        __set_short_size(0);
3094
12.4M
    }
3095
12.6M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::clear()
Line
Count
Source
3083
12.6M
{
3084
12.6M
    __invalidate_all_iterators();
3085
12.6M
    if (__is_long())
3086
203k
    {
3087
203k
        traits_type::assign(*__get_long_pointer(), value_type());
3088
203k
        __set_long_size(0);
3089
203k
    }
3090
12.4M
    else
3091
12.4M
    {
3092
12.4M
        traits_type::assign(*__get_short_pointer(), value_type());
3093
12.4M
        __set_short_size(0);
3094
12.4M
    }
3095
12.6M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::clear()
Line
Count
Source
3083
1
{
3084
1
    __invalidate_all_iterators();
3085
1
    if (__is_long())
3086
1
    {
3087
1
        traits_type::assign(*__get_long_pointer(), value_type());
3088
1
        __set_long_size(0);
3089
1
    }
3090
0
    else
3091
0
    {
3092
0
        traits_type::assign(*__get_short_pointer(), value_type());
3093
0
        __set_short_size(0);
3094
0
    }
3095
1
}
3096
3097
template <class _CharT, class _Traits, class _Allocator>
3098
inline
3099
void
3100
basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos)
3101
31.8k
{
3102
31.8k
    if (__is_long())
3103
29.5k
    {
3104
29.5k
        traits_type::assign(*(__get_long_pointer() + __pos), value_type());
3105
29.5k
        __set_long_size(__pos);
3106
29.5k
    }
3107
2.37k
    else
3108
2.37k
    {
3109
2.37k
        traits_type::assign(*(__get_short_pointer() + __pos), value_type());
3110
2.37k
        __set_short_size(__pos);
3111
2.37k
    }
3112
31.8k
    __invalidate_iterators_past(__pos);
3113
31.8k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__erase_to_end(unsigned long)
Line
Count
Source
3101
31.8k
{
3102
31.8k
    if (__is_long())
3103
29.5k
    {
3104
29.5k
        traits_type::assign(*(__get_long_pointer() + __pos), value_type());
3105
29.5k
        __set_long_size(__pos);
3106
29.5k
    }
3107
2.37k
    else
3108
2.37k
    {
3109
2.37k
        traits_type::assign(*(__get_short_pointer() + __pos), value_type());
3110
2.37k
        __set_short_size(__pos);
3111
2.37k
    }
3112
31.8k
    __invalidate_iterators_past(__pos);
3113
31.8k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__erase_to_end(unsigned long)
3114
3115
template <class _CharT, class _Traits, class _Allocator>
3116
void
3117
basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
3118
29.2M
{
3119
29.2M
    size_type __sz = size();
3120
29.2M
    if (__n > __sz)
3121
29.2M
        append(__n - __sz, __c);
3122
31.8k
    else
3123
31.8k
        __erase_to_end(__n);
3124
29.2M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)
Line
Count
Source
3118
29.2M
{
3119
29.2M
    size_type __sz = size();
3120
29.2M
    if (__n > __sz)
3121
29.2M
        append(__n - __sz, __c);
3122
31.8k
    else
3123
31.8k
        __erase_to_end(__n);
3124
29.2M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::resize(unsigned long, wchar_t)
3125
3126
template <class _CharT, class _Traits, class _Allocator>
3127
inline void
3128
basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
3129
0
{
3130
0
    size_type __sz = size();
3131
0
    if (__n > __sz) {
3132
0
       __append_default_init(__n - __sz);
3133
0
    } else
3134
0
        __erase_to_end(__n);
3135
0
}
3136
3137
template <class _CharT, class _Traits, class _Allocator>
3138
inline
3139
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3140
basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
3141
256M
{
3142
256M
    size_type __m = __alloc_traits::max_size(__alloc());
3143
#ifdef _LIBCPP_BIG_ENDIAN
3144
    return (__m <= ~__long_mask ? __m : __m/2) - __alignment;
3145
#else
3146
    return __m - __alignment;
3147
256M
#endif
3148
256M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::max_size() const
Line
Count
Source
3141
256M
{
3142
256M
    size_type __m = __alloc_traits::max_size(__alloc());
3143
#ifdef _LIBCPP_BIG_ENDIAN
3144
    return (__m <= ~__long_mask ? __m : __m/2) - __alignment;
3145
#else
3146
    return __m - __alignment;
3147
256M
#endif
3148
256M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::max_size() const
Line
Count
Source
3141
2
{
3142
2
    size_type __m = __alloc_traits::max_size(__alloc());
3143
#ifdef _LIBCPP_BIG_ENDIAN
3144
    return (__m <= ~__long_mask ? __m : __m/2) - __alignment;
3145
#else
3146
    return __m - __alignment;
3147
2
#endif
3148
2
}
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::max_size() const
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::max_size() const
3149
3150
template <class _CharT, class _Traits, class _Allocator>
3151
void
3152
basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
3153
11.4M
{
3154
11.4M
    if (__res_arg > max_size())
3155
0
        this->__throw_length_error();
3156
11.4M
    size_type __cap = capacity();
3157
11.4M
    size_type __sz = size();
3158
11.4M
    __res_arg = _VSTD::max(__res_arg, __sz);
3159
11.4M
    __res_arg = __recommend(__res_arg);
3160
11.4M
    if (__res_arg != __cap)
3161
5.75M
    {
3162
5.75M
        pointer __new_data, __p;
3163
5.75M
        bool __was_long, __now_long;
3164
5.75M
        if (__res_arg == __min_cap - 1)
3165
0
        {
3166
0
            __was_long = true;
3167
0
            __now_long = false;
3168
0
            __new_data = __get_short_pointer();
3169
0
            __p = __get_long_pointer();
3170
0
        }
3171
5.75M
        else
3172
5.75M
        {
3173
5.75M
            if (__res_arg > __cap)
3174
5.75M
                __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
3175
0
            else
3176
0
            {
3177
0
            #ifndef _LIBCPP_NO_EXCEPTIONS
3178
0
                try
3179
0
                {
3180
0
            #endif  // _LIBCPP_NO_EXCEPTIONS
3181
0
                    __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
3182
0
            #ifndef _LIBCPP_NO_EXCEPTIONS
3183
0
                }
3184
0
                catch (...)
3185
0
                {
3186
0
                    return;
3187
0
                }
3188
            #else  // _LIBCPP_NO_EXCEPTIONS
3189
                if (__new_data == nullptr)
3190
                    return;
3191
            #endif  // _LIBCPP_NO_EXCEPTIONS
3192
            }
3193
5.75M
            __now_long = true;
3194
5.75M
            __was_long = __is_long();
3195
5.75M
            __p = __get_pointer();
3196
5.75M
        }
3197
5.75M
        traits_type::copy(_VSTD::__to_address(__new_data),
3198
5.75M
                          _VSTD::__to_address(__p), size()+1);
3199
5.75M
        if (__was_long)
3200
0
            __alloc_traits::deallocate(__alloc(), __p, __cap+1);
3201
5.75M
        if (__now_long)
3202
5.75M
        {
3203
5.75M
            __set_long_cap(__res_arg+1);
3204
5.75M
            __set_long_size(__sz);
3205
5.75M
            __set_long_pointer(__new_data);
3206
5.75M
        }
3207
0
        else
3208
0
            __set_short_size(__sz);
3209
5.75M
        __invalidate_all_iterators();
3210
5.75M
    }
3211
11.4M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)
Line
Count
Source
3153
11.4M
{
3154
11.4M
    if (__res_arg > max_size())
3155
0
        this->__throw_length_error();
3156
11.4M
    size_type __cap = capacity();
3157
11.4M
    size_type __sz = size();
3158
11.4M
    __res_arg = _VSTD::max(__res_arg, __sz);
3159
11.4M
    __res_arg = __recommend(__res_arg);
3160
11.4M
    if (__res_arg != __cap)
3161
5.75M
    {
3162
5.75M
        pointer __new_data, __p;
3163
5.75M
        bool __was_long, __now_long;
3164
5.75M
        if (__res_arg == __min_cap - 1)
3165
0
        {
3166
0
            __was_long = true;
3167
0
            __now_long = false;
3168
0
            __new_data = __get_short_pointer();
3169
0
            __p = __get_long_pointer();
3170
0
        }
3171
5.75M
        else
3172
5.75M
        {
3173
5.75M
            if (__res_arg > __cap)
3174
5.75M
                __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
3175
0
            else
3176
0
            {
3177
0
            #ifndef _LIBCPP_NO_EXCEPTIONS
3178
0
                try
3179
0
                {
3180
0
            #endif  // _LIBCPP_NO_EXCEPTIONS
3181
0
                    __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
3182
0
            #ifndef _LIBCPP_NO_EXCEPTIONS
3183
0
                }
3184
0
                catch (...)
3185
0
                {
3186
0
                    return;
3187
0
                }
3188
            #else  // _LIBCPP_NO_EXCEPTIONS
3189
                if (__new_data == nullptr)
3190
                    return;
3191
            #endif  // _LIBCPP_NO_EXCEPTIONS
3192
            }
3193
5.75M
            __now_long = true;
3194
5.75M
            __was_long = __is_long();
3195
5.75M
            __p = __get_pointer();
3196
5.75M
        }
3197
5.75M
        traits_type::copy(_VSTD::__to_address(__new_data),
3198
5.75M
                          _VSTD::__to_address(__p), size()+1);
3199
5.75M
        if (__was_long)
3200
0
            __alloc_traits::deallocate(__alloc(), __p, __cap+1);
3201
5.75M
        if (__now_long)
3202
5.75M
        {
3203
5.75M
            __set_long_cap(__res_arg+1);
3204
5.75M
            __set_long_size(__sz);
3205
5.75M
            __set_long_pointer(__new_data);
3206
5.75M
        }
3207
0
        else
3208
0
            __set_short_size(__sz);
3209
5.75M
        __invalidate_all_iterators();
3210
5.75M
    }
3211
11.4M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::reserve(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char16_t, std::__1::char_traits<char16_t>, std::__1::allocator<char16_t> >::reserve(unsigned long)
Unexecuted instantiation: std::__1::basic_string<char32_t, std::__1::char_traits<char32_t>, std::__1::allocator<char32_t> >::reserve(unsigned long)
3212
3213
template <class _CharT, class _Traits, class _Allocator>
3214
inline
3215
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3216
basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const _NOEXCEPT
3217
9.20M
{
3218
9.20M
    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
3219
9.20M
    return *(data() + __pos);
3220
9.20M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator[](unsigned long) const
Line
Count
Source
3217
9.20M
{
3218
9.20M
    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
3219
9.20M
    return *(data() + __pos);
3220
9.20M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator[](unsigned long) const
3221
3222
template <class _CharT, class _Traits, class _Allocator>
3223
inline
3224
typename basic_string<_CharT, _Traits, _Allocator>::reference
3225
basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) _NOEXCEPT
3226
418M
{
3227
418M
    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
3228
418M
    return *(__get_pointer() + __pos);
3229
418M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator[](unsigned long)
Line
Count
Source
3226
418M
{
3227
418M
    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
3228
418M
    return *(__get_pointer() + __pos);
3229
418M
}
std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::operator[](unsigned long)
Line
Count
Source
3226
14
{
3227
14
    _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds");
3228
14
    return *(__get_pointer() + __pos);
3229
14
}
3230
3231
template <class _CharT, class _Traits, class _Allocator>
3232
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3233
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
3234
0
{
3235
0
    if (__n >= size())
3236
0
        this->__throw_out_of_range();
3237
0
    return (*this)[__n];
3238
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::at(unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::at(unsigned long) const
3239
3240
template <class _CharT, class _Traits, class _Allocator>
3241
typename basic_string<_CharT, _Traits, _Allocator>::reference
3242
basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
3243
0
{
3244
0
    if (__n >= size())
3245
0
        this->__throw_out_of_range();
3246
0
    return (*this)[__n];
3247
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::at(unsigned long)
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::at(unsigned long)
3248
3249
template <class _CharT, class _Traits, class _Allocator>
3250
inline
3251
typename basic_string<_CharT, _Traits, _Allocator>::reference
3252
basic_string<_CharT, _Traits, _Allocator>::front() _NOEXCEPT
3253
{
3254
    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
3255
    return *__get_pointer();
3256
}
3257
3258
template <class _CharT, class _Traits, class _Allocator>
3259
inline
3260
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3261
basic_string<_CharT, _Traits, _Allocator>::front() const _NOEXCEPT
3262
{
3263
    _LIBCPP_ASSERT(!empty(), "string::front(): string is empty");
3264
    return *data();
3265
}
3266
3267
template <class _CharT, class _Traits, class _Allocator>
3268
inline
3269
typename basic_string<_CharT, _Traits, _Allocator>::reference
3270
basic_string<_CharT, _Traits, _Allocator>::back() _NOEXCEPT
3271
1.89k
{
3272
1.89k
    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
3273
1.89k
    return *(__get_pointer() + size() - 1);
3274
1.89k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::back()
Line
Count
Source
3271
1.89k
{
3272
1.89k
    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
3273
1.89k
    return *(__get_pointer() + size() - 1);
3274
1.89k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::back()
3275
3276
template <class _CharT, class _Traits, class _Allocator>
3277
inline
3278
typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3279
basic_string<_CharT, _Traits, _Allocator>::back() const _NOEXCEPT
3280
9
{
3281
9
    _LIBCPP_ASSERT(!empty(), "string::back(): string is empty");
3282
9
    return *(data() + size() - 1);
3283
9
}
3284
3285
template <class _CharT, class _Traits, class _Allocator>
3286
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3287
basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
3288
0
{
3289
0
    size_type __sz = size();
3290
0
    if (__pos > __sz)
3291
0
        this->__throw_out_of_range();
3292
0
    size_type __rlen = _VSTD::min(__n, __sz - __pos);
3293
0
    traits_type::copy(__s, data() + __pos, __rlen);
3294
0
    return __rlen;
3295
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::copy(char*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::copy(wchar_t*, unsigned long, unsigned long) const
3296
3297
template <class _CharT, class _Traits, class _Allocator>
3298
inline
3299
basic_string<_CharT, _Traits, _Allocator>
3300
basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const
3301
{
3302
    return basic_string(*this, __pos, __n, __alloc());
3303
}
3304
3305
template <class _CharT, class _Traits, class _Allocator>
3306
inline
3307
void
3308
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
3309
#if _LIBCPP_STD_VER >= 14
3310
        _NOEXCEPT
3311
#else
3312
        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
3313
                    __is_nothrow_swappable<allocator_type>::value)
3314
#endif
3315
{
3316
#if _LIBCPP_DEBUG_LEVEL >= 2
3317
    if (!__is_long())
3318
        __get_db()->__invalidate_all(this);
3319
    if (!__str.__is_long())
3320
        __get_db()->__invalidate_all(&__str);
3321
    __get_db()->swap(this, &__str);
3322
#endif
3323
    _LIBCPP_ASSERT(
3324
        __alloc_traits::propagate_on_container_swap::value ||
3325
        __alloc_traits::is_always_equal::value ||
3326
        __alloc() == __str.__alloc(), "swapping non-equal allocators");
3327
    _VSTD::swap(__r_.first(), __str.__r_.first());
3328
    __swap_allocator(__alloc(), __str.__alloc());
3329
}
3330
3331
// find
3332
3333
template <class _Traits>
3334
struct _LIBCPP_HIDDEN __traits_eq
3335
{
3336
    typedef typename _Traits::char_type char_type;
3337
    _LIBCPP_INLINE_VISIBILITY
3338
    bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT
3339
        {return _Traits::eq(__x, __y);}
3340
};
3341
3342
template<class _CharT, class _Traits, class _Allocator>
3343
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3344
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
3345
                                                size_type __pos,
3346
                                                size_type __n) const _NOEXCEPT
3347
0
{
3348
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
3349
0
    return __str_find<value_type, size_type, traits_type, npos>
3350
0
        (data(), size(), __s, __pos, __n);
3351
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find(wchar_t const*, unsigned long, unsigned long) const
3352
3353
template<class _CharT, class _Traits, class _Allocator>
3354
inline
3355
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3356
basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
3357
                                                size_type __pos) const _NOEXCEPT
3358
{
3359
    return __str_find<value_type, size_type, traits_type, npos>
3360
        (data(), size(), __str.data(), __pos, __str.size());
3361
}
3362
3363
template<class _CharT, class _Traits, class _Allocator>
3364
template <class _Tp>
3365
_EnableIf
3366
<
3367
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3368
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3369
>
3370
basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
3371
                                                size_type __pos) const
3372
{
3373
    __self_view __sv = __t;
3374
    return __str_find<value_type, size_type, traits_type, npos>
3375
        (data(), size(), __sv.data(), __pos, __sv.size());
3376
}
3377
3378
template<class _CharT, class _Traits, class _Allocator>
3379
inline
3380
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3381
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
3382
                                                size_type __pos) const _NOEXCEPT
3383
{
3384
    _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
3385
    return __str_find<value_type, size_type, traits_type, npos>
3386
        (data(), size(), __s, __pos, traits_type::length(__s));
3387
}
3388
3389
template<class _CharT, class _Traits, class _Allocator>
3390
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3391
basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
3392
                                                size_type __pos) const _NOEXCEPT
3393
275
{
3394
275
    return __str_find<value_type, size_type, traits_type, npos>
3395
275
        (data(), size(), __c, __pos);
3396
275
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const
Line
Count
Source
3393
275
{
3394
275
    return __str_find<value_type, size_type, traits_type, npos>
3395
275
        (data(), size(), __c, __pos);
3396
275
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find(wchar_t, unsigned long) const
3397
3398
// rfind
3399
3400
template<class _CharT, class _Traits, class _Allocator>
3401
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3402
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
3403
                                                 size_type __pos,
3404
                                                 size_type __n) const _NOEXCEPT
3405
0
{
3406
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
3407
0
    return __str_rfind<value_type, size_type, traits_type, npos>
3408
0
        (data(), size(), __s, __pos, __n);
3409
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::rfind(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::rfind(wchar_t const*, unsigned long, unsigned long) const
3410
3411
template<class _CharT, class _Traits, class _Allocator>
3412
inline
3413
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3414
basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
3415
                                                 size_type __pos) const _NOEXCEPT
3416
{
3417
    return __str_rfind<value_type, size_type, traits_type, npos>
3418
        (data(), size(), __str.data(), __pos, __str.size());
3419
}
3420
3421
template<class _CharT, class _Traits, class _Allocator>
3422
template <class _Tp>
3423
_EnableIf
3424
<
3425
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3426
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3427
>
3428
basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
3429
                                                size_type __pos) const
3430
{
3431
    __self_view __sv = __t;
3432
    return __str_rfind<value_type, size_type, traits_type, npos>
3433
        (data(), size(), __sv.data(), __pos, __sv.size());
3434
}
3435
3436
template<class _CharT, class _Traits, class _Allocator>
3437
inline
3438
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3439
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
3440
                                                 size_type __pos) const _NOEXCEPT
3441
{
3442
    _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
3443
    return __str_rfind<value_type, size_type, traits_type, npos>
3444
        (data(), size(), __s, __pos, traits_type::length(__s));
3445
}
3446
3447
template<class _CharT, class _Traits, class _Allocator>
3448
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3449
basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
3450
                                                 size_type __pos) const _NOEXCEPT
3451
8.74k
{
3452
8.74k
    return __str_rfind<value_type, size_type, traits_type, npos>
3453
8.74k
        (data(), size(), __c, __pos);
3454
8.74k
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::rfind(char, unsigned long) const
Line
Count
Source
3451
8.74k
{
3452
8.74k
    return __str_rfind<value_type, size_type, traits_type, npos>
3453
8.74k
        (data(), size(), __c, __pos);
3454
8.74k
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::rfind(wchar_t, unsigned long) const
3455
3456
// find_first_of
3457
3458
template<class _CharT, class _Traits, class _Allocator>
3459
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3460
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
3461
                                                         size_type __pos,
3462
                                                         size_type __n) const _NOEXCEPT
3463
0
{
3464
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
3465
0
    return __str_find_first_of<value_type, size_type, traits_type, npos>
3466
0
        (data(), size(), __s, __pos, __n);
3467
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_first_of(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find_first_of(wchar_t const*, unsigned long, unsigned long) const
3468
3469
template<class _CharT, class _Traits, class _Allocator>
3470
inline
3471
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3472
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
3473
                                                         size_type __pos) const _NOEXCEPT
3474
{
3475
    return __str_find_first_of<value_type, size_type, traits_type, npos>
3476
        (data(), size(), __str.data(), __pos, __str.size());
3477
}
3478
3479
template<class _CharT, class _Traits, class _Allocator>
3480
template <class _Tp>
3481
_EnableIf
3482
<
3483
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3484
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3485
>
3486
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
3487
                                                size_type __pos) const
3488
{
3489
    __self_view __sv = __t;
3490
    return __str_find_first_of<value_type, size_type, traits_type, npos>
3491
        (data(), size(), __sv.data(), __pos, __sv.size());
3492
}
3493
3494
template<class _CharT, class _Traits, class _Allocator>
3495
inline
3496
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3497
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
3498
                                                         size_type __pos) const _NOEXCEPT
3499
{
3500
    _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
3501
    return __str_find_first_of<value_type, size_type, traits_type, npos>
3502
        (data(), size(), __s, __pos, traits_type::length(__s));
3503
}
3504
3505
template<class _CharT, class _Traits, class _Allocator>
3506
inline
3507
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3508
basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
3509
                                                         size_type __pos) const _NOEXCEPT
3510
{
3511
    return find(__c, __pos);
3512
}
3513
3514
// find_last_of
3515
3516
template<class _CharT, class _Traits, class _Allocator>
3517
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3518
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
3519
                                                        size_type __pos,
3520
                                                        size_type __n) const _NOEXCEPT
3521
0
{
3522
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
3523
0
    return __str_find_last_of<value_type, size_type, traits_type, npos>
3524
0
        (data(), size(), __s, __pos, __n);
3525
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_last_of(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find_last_of(wchar_t const*, unsigned long, unsigned long) const
3526
3527
template<class _CharT, class _Traits, class _Allocator>
3528
inline
3529
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3530
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
3531
                                                        size_type __pos) const _NOEXCEPT
3532
{
3533
    return __str_find_last_of<value_type, size_type, traits_type, npos>
3534
        (data(), size(), __str.data(), __pos, __str.size());
3535
}
3536
3537
template<class _CharT, class _Traits, class _Allocator>
3538
template <class _Tp>
3539
_EnableIf
3540
<
3541
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3542
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3543
>
3544
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
3545
                                                size_type __pos) const
3546
{
3547
    __self_view __sv = __t;
3548
    return __str_find_last_of<value_type, size_type, traits_type, npos>
3549
        (data(), size(), __sv.data(), __pos, __sv.size());
3550
}
3551
3552
template<class _CharT, class _Traits, class _Allocator>
3553
inline
3554
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3555
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
3556
                                                        size_type __pos) const _NOEXCEPT
3557
{
3558
    _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
3559
    return __str_find_last_of<value_type, size_type, traits_type, npos>
3560
        (data(), size(), __s, __pos, traits_type::length(__s));
3561
}
3562
3563
template<class _CharT, class _Traits, class _Allocator>
3564
inline
3565
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3566
basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
3567
                                                        size_type __pos) const _NOEXCEPT
3568
{
3569
    return rfind(__c, __pos);
3570
}
3571
3572
// find_first_not_of
3573
3574
template<class _CharT, class _Traits, class _Allocator>
3575
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3576
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
3577
                                                             size_type __pos,
3578
                                                             size_type __n) const _NOEXCEPT
3579
0
{
3580
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
3581
0
    return __str_find_first_not_of<value_type, size_type, traits_type, npos>
3582
0
        (data(), size(), __s, __pos, __n);
3583
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_first_not_of(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find_first_not_of(wchar_t const*, unsigned long, unsigned long) const
3584
3585
template<class _CharT, class _Traits, class _Allocator>
3586
inline
3587
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3588
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
3589
                                                             size_type __pos) const _NOEXCEPT
3590
{
3591
    return __str_find_first_not_of<value_type, size_type, traits_type, npos>
3592
        (data(), size(), __str.data(), __pos, __str.size());
3593
}
3594
3595
template<class _CharT, class _Traits, class _Allocator>
3596
template <class _Tp>
3597
_EnableIf
3598
<
3599
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3600
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3601
>
3602
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
3603
                                                size_type __pos) const
3604
{
3605
    __self_view __sv = __t;
3606
    return __str_find_first_not_of<value_type, size_type, traits_type, npos>
3607
        (data(), size(), __sv.data(), __pos, __sv.size());
3608
}
3609
3610
template<class _CharT, class _Traits, class _Allocator>
3611
inline
3612
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3613
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
3614
                                                             size_type __pos) const _NOEXCEPT
3615
{
3616
    _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
3617
    return __str_find_first_not_of<value_type, size_type, traits_type, npos>
3618
        (data(), size(), __s, __pos, traits_type::length(__s));
3619
}
3620
3621
template<class _CharT, class _Traits, class _Allocator>
3622
inline
3623
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3624
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
3625
                                                             size_type __pos) const _NOEXCEPT
3626
{
3627
    return __str_find_first_not_of<value_type, size_type, traits_type, npos>
3628
        (data(), size(), __c, __pos);
3629
}
3630
3631
// find_last_not_of
3632
3633
template<class _CharT, class _Traits, class _Allocator>
3634
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3635
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
3636
                                                            size_type __pos,
3637
                                                            size_type __n) const _NOEXCEPT
3638
0
{
3639
0
    _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
3640
0
    return __str_find_last_not_of<value_type, size_type, traits_type, npos>
3641
0
        (data(), size(), __s, __pos, __n);
3642
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_last_not_of(char const*, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::find_last_not_of(wchar_t const*, unsigned long, unsigned long) const
3643
3644
template<class _CharT, class _Traits, class _Allocator>
3645
inline
3646
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3647
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
3648
                                                            size_type __pos) const _NOEXCEPT
3649
{
3650
    return __str_find_last_not_of<value_type, size_type, traits_type, npos>
3651
        (data(), size(), __str.data(), __pos, __str.size());
3652
}
3653
3654
template<class _CharT, class _Traits, class _Allocator>
3655
template <class _Tp>
3656
_EnableIf
3657
<
3658
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3659
    typename basic_string<_CharT, _Traits, _Allocator>::size_type
3660
>
3661
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
3662
                                                size_type __pos) const
3663
{
3664
    __self_view __sv = __t;
3665
    return __str_find_last_not_of<value_type, size_type, traits_type, npos>
3666
        (data(), size(), __sv.data(), __pos, __sv.size());
3667
}
3668
3669
template<class _CharT, class _Traits, class _Allocator>
3670
inline
3671
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3672
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
3673
                                                            size_type __pos) const _NOEXCEPT
3674
{
3675
    _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
3676
    return __str_find_last_not_of<value_type, size_type, traits_type, npos>
3677
        (data(), size(), __s, __pos, traits_type::length(__s));
3678
}
3679
3680
template<class _CharT, class _Traits, class _Allocator>
3681
inline
3682
typename basic_string<_CharT, _Traits, _Allocator>::size_type
3683
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
3684
                                                            size_type __pos) const _NOEXCEPT
3685
{
3686
    return __str_find_last_not_of<value_type, size_type, traits_type, npos>
3687
        (data(), size(), __c, __pos);
3688
}
3689
3690
// compare
3691
3692
template <class _CharT, class _Traits, class _Allocator>
3693
template <class _Tp>
3694
_EnableIf
3695
<
3696
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3697
    int
3698
>
3699
basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const
3700
{
3701
    __self_view __sv = __t;
3702
    size_t __lhs_sz = size();
3703
    size_t __rhs_sz = __sv.size();
3704
    int __result = traits_type::compare(data(), __sv.data(),
3705
                                        _VSTD::min(__lhs_sz, __rhs_sz));
3706
    if (__result != 0)
3707
        return __result;
3708
    if (__lhs_sz < __rhs_sz)
3709
        return -1;
3710
    if (__lhs_sz > __rhs_sz)
3711
        return 1;
3712
    return 0;
3713
}
3714
3715
template <class _CharT, class _Traits, class _Allocator>
3716
inline
3717
int
3718
basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
3719
{
3720
    return compare(__self_view(__str));
3721
}
3722
3723
template <class _CharT, class _Traits, class _Allocator>
3724
int
3725
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3726
                                                   size_type __n1,
3727
                                                   const value_type* __s,
3728
                                                   size_type __n2) const
3729
3.02M
{
3730
3.02M
    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
3731
3.02M
    size_type __sz = size();
3732
3.02M
    if (
__pos1 > __sz3.02M
|| __n2 == npos)
3733
0
        this->__throw_out_of_range();
3734
3.02M
    size_type __rlen = _VSTD::min(__n1, __sz - __pos1);
3735
3.02M
    int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2));
3736
3.02M
    if (__r == 0)
3737
1.13M
    {
3738
1.13M
        if (__rlen < __n2)
3739
0
            __r = -1;
3740
1.13M
        else if (__rlen > __n2)
3741
0
            __r = 1;
3742
1.13M
    }
3743
3.02M
    return __r;
3744
3.02M
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const
Line
Count
Source
3729
3.02M
{
3730
3.02M
    _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
3731
3.02M
    size_type __sz = size();
3732
3.02M
    if (
__pos1 > __sz3.02M
|| __n2 == npos)
3733
0
        this->__throw_out_of_range();
3734
3.02M
    size_type __rlen = _VSTD::min(__n1, __sz - __pos1);
3735
3.02M
    int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2));
3736
3.02M
    if (__r == 0)
3737
1.13M
    {
3738
1.13M
        if (__rlen < __n2)
3739
0
            __r = -1;
3740
1.13M
        else if (__rlen > __n2)
3741
0
            __r = 1;
3742
1.13M
    }
3743
3.02M
    return __r;
3744
3.02M
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(unsigned long, unsigned long, wchar_t const*, unsigned long) const
3745
3746
template <class _CharT, class _Traits, class _Allocator>
3747
template <class _Tp>
3748
_EnableIf
3749
<
3750
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
3751
    int
3752
>
3753
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3754
                                                   size_type __n1,
3755
                                                   const _Tp& __t) const
3756
{
3757
    __self_view __sv = __t;
3758
    return compare(__pos1, __n1, __sv.data(), __sv.size());
3759
}
3760
3761
template <class _CharT, class _Traits, class _Allocator>
3762
inline
3763
int
3764
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3765
                                                   size_type __n1,
3766
                                                   const basic_string& __str) const
3767
{
3768
    return compare(__pos1, __n1, __str.data(), __str.size());
3769
}
3770
3771
template <class _CharT, class _Traits, class _Allocator>
3772
template <class _Tp>
3773
_EnableIf
3774
<
3775
    __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value
3776
    && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value,
3777
    int
3778
>
3779
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3780
                                                   size_type __n1,
3781
                                                   const _Tp& __t,
3782
                                                   size_type __pos2,
3783
                                                   size_type __n2) const
3784
0
{
3785
0
    __self_view __sv = __t;
3786
0
    return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
3787
0
}
Unexecuted instantiation: std::__1::_MetaBase<(__can_be_converted_to_string_view<char, std::__1::char_traits<char>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >::value) && (!(__is_same_uncvref<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value))>::_EnableIfImpl<int> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare<std::__1::basic_string_view<char, std::__1::char_traits<char> > >(unsigned long, unsigned long, std::__1::basic_string_view<char, std::__1::char_traits<char> > const&, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::_MetaBase<(__can_be_converted_to_string_view<wchar_t, std::__1::char_traits<wchar_t>, std::__1::basic_string_view<wchar_t, std::__1::char_traits<wchar_t> > >::value) && (!(__is_same_uncvref<std::__1::basic_string_view<wchar_t, std::__1::char_traits<wchar_t> >, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >::value))>::_EnableIfImpl<int> std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare<std::__1::basic_string_view<wchar_t, std::__1::char_traits<wchar_t> > >(unsigned long, unsigned long, std::__1::basic_string_view<wchar_t, std::__1::char_traits<wchar_t> > const&, unsigned long, unsigned long) const
3788
3789
template <class _CharT, class _Traits, class _Allocator>
3790
int
3791
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3792
                                                   size_type __n1,
3793
                                                   const basic_string& __str,
3794
                                                   size_type __pos2,
3795
                                                   size_type __n2) const
3796
0
{
3797
0
        return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
3798
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(unsigned long, unsigned long, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, unsigned long, unsigned long) const
3799
3800
template <class _CharT, class _Traits, class _Allocator>
3801
int
3802
basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
3803
30
{
3804
30
    _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
3805
30
    return compare(0, npos, __s, traits_type::length(__s));
3806
30
}
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const
Line
Count
Source
3803
30
{
3804
30
    _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
3805
30
    return compare(0, npos, __s, traits_type::length(__s));
3806
30
}
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(wchar_t const*) const
3807
3808
template <class _CharT, class _Traits, class _Allocator>
3809
int
3810
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3811
                                                   size_type __n1,
3812
                                                   const value_type* __s) const
3813
0
{
3814
0
    _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr");
3815
0
    return compare(__pos1, __n1, __s, traits_type::length(__s));
3816
0
}
Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*) const
Unexecuted instantiation: std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(unsigned long, unsigned long, wchar_t const*) const
3817
3818
// __invariants
3819
3820
template<class _CharT, class _Traits, class _Allocator>
3821
inline
3822
bool
3823
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
3824
{
3825
    if (size() > capacity())
3826
        return false;
3827
    if (capacity() < __min_cap - 1)
3828
        return false;
3829
    if (data() == 0)
3830
        return false;
3831
    if (data()[size()] != value_type(0))
3832
        return false;
3833
    return true;
3834
}
3835
3836
// __clear_and_shrink
3837
3838
template<class _CharT, class _Traits, class _Allocator>
3839
inline
3840
void
3841
basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
3842
{
3843
    clear();
3844
    if(__is_long())
3845
    {
3846
        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1);
3847
        __set_long_cap(0);
3848
        __set_short_size(0);
3849
    }
3850
}
3851
3852
// operator==
3853
3854
template<class _CharT, class _Traits, class _Allocator>
3855
inline _LIBCPP_INLINE_VISIBILITY
3856
bool
3857
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3858
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3859
{
3860
    size_t __lhs_sz = __lhs.size();
3861
    return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
3862
                                                        __rhs.data(),
3863
                                                        __lhs_sz) == 0;
3864
}
3865
3866
template<class _Allocator>
3867
inline _LIBCPP_INLINE_VISIBILITY
3868
bool
3869
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
3870
           const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
3871
27.5M
{
3872
27.5M
    size_t __lhs_sz = __lhs.size();
3873
27.5M
    if (__lhs_sz != __rhs.size())
3874
16.7M
        return false;
3875
10.7M
    const char* __lp = __lhs.data();
3876
10.7M
    const char* __rp = __rhs.data();
3877
10.7M
    if (__lhs.__is_long())
3878
256k
        return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
3879
65.4M
    
for (; 10.5M
__lhs_sz != 0;
--__lhs_sz, ++__lp, ++__rp54.9M
)
3880
63.3M
        if (*__lp != *__rp)
3881
8.39M
            return false;
3882
10.5M
    
return true2.13M
;
3883
10.5M
}
3884
3885
template<class _CharT, class _Traits, class _Allocator>
3886
inline _LIBCPP_INLINE_VISIBILITY
3887
bool
3888
operator==(const _CharT* __lhs,
3889
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3890
{
3891
    typedef basic_string<_CharT, _Traits, _Allocator> _String;
3892
    _LIBCPP_ASSERT(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
3893
    size_t __lhs_len = _Traits::length(__lhs);
3894
    if (__lhs_len != __rhs.size()) return false;
3895
    return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
3896
}
3897
3898
template<class _CharT, class _Traits, class _Allocator>
3899
inline _LIBCPP_INLINE_VISIBILITY
3900
bool
3901
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
3902
           const _CharT* __rhs) _NOEXCEPT
3903
66.3M
{
3904
66.3M
    typedef basic_string<_CharT, _Traits, _Allocator> _String;
3905
66.3M
    _LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
3906
66.3M
    size_t __rhs_len = _Traits::length(__rhs);
3907
66.3M
    if (__rhs_len != __lhs.size()) 
return false58.2M
;
3908
8.13M
    return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
3909
8.13M
}
3910
3911
template<class _CharT, class _Traits, class _Allocator>
3912
inline _LIBCPP_INLINE_VISIBILITY
3913
bool
3914
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
3915
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3916
{
3917
    return !(__lhs == __rhs);
3918
}
3919
3920
template<class _CharT, class _Traits, class _Allocator>
3921
inline _LIBCPP_INLINE_VISIBILITY
3922
bool
3923
operator!=(const _CharT* __lhs,
3924
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3925
{
3926
    return !(__lhs == __rhs);
3927
}
3928
3929
template<class _CharT, class _Traits, class _Allocator>
3930
inline _LIBCPP_INLINE_VISIBILITY
3931
bool
3932
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3933
           const _CharT* __rhs) _NOEXCEPT
3934
3.28M
{
3935
3.28M
    return !(__lhs == __rhs);
3936
3.28M
}
3937
3938
// operator<
3939
3940
template<class _CharT, class _Traits, class _Allocator>
3941
inline _LIBCPP_INLINE_VISIBILITY
3942
bool
3943
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3944
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3945
{
3946
    return __lhs.compare(__rhs) < 0;
3947
}
3948
3949
template<class _CharT, class _Traits, class _Allocator>
3950
inline _LIBCPP_INLINE_VISIBILITY
3951
bool
3952
operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3953
           const _CharT* __rhs) _NOEXCEPT
3954
{
3955
    return __lhs.compare(__rhs) < 0;
3956
}
3957
3958
template<class _CharT, class _Traits, class _Allocator>
3959
inline _LIBCPP_INLINE_VISIBILITY
3960
bool
3961
operator< (const _CharT* __lhs,
3962
           const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3963
{
3964
    return __rhs.compare(__lhs) > 0;
3965
}
3966
3967
// operator>
3968
3969
template<class _CharT, class _Traits, class _Allocator>
3970
inline _LIBCPP_INLINE_VISIBILITY
3971
bool