Coverage Report

Created: 2025-08-28 06:28

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