34#ifndef _BASIC_STRING_H
35#define _BASIC_STRING_H 1
37#pragma GCC system_header
42#if __cplusplus >= 201103L
46#if __cplusplus >= 201703L
50#if ! _GLIBCXX_USE_CXX11_ABI
53namespace std _GLIBCXX_VISIBILITY(default)
55_GLIBCXX_BEGIN_NAMESPACE_VERSION
56_GLIBCXX_BEGIN_NAMESPACE_CXX11
58#ifdef __cpp_lib_is_constant_evaluated
60# define __cpp_lib_constexpr_string 201907L
61#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
63# define __cpp_lib_constexpr_string 201611L
84 template<
typename _CharT,
typename _Traits,
typename _Alloc>
88 rebind<_CharT>::other _Char_alloc_type;
90#if __cpp_lib_constexpr_string < 201907L
93 template<
typename _Traits2,
typename _Dummy_for_PR85282>
98 [[__gnu__::__always_inline__]]
99 static constexpr typename _Base::pointer
100 allocate(_Char_alloc_type& __a,
typename _Base::size_type __n)
102 pointer __p = _Base::allocate(__a, __n);
105 for (size_type __i = 0; __i < __n; ++__i)
106 std::construct_at(__builtin_addressof(__p[__i]));
111 template<
typename _Dummy_for_PR85282>
112 struct _Alloc_traits_impl<char_traits<_CharT>, _Dummy_for_PR85282>
118 using _Alloc_traits = _Alloc_traits_impl<_Traits, void>;
123 typedef _Traits traits_type;
124 typedef typename _Traits::char_type value_type;
125 typedef _Char_alloc_type allocator_type;
126 typedef typename _Alloc_traits::size_type size_type;
127 typedef typename _Alloc_traits::difference_type difference_type;
128 typedef typename _Alloc_traits::reference reference;
129 typedef typename _Alloc_traits::const_reference const_reference;
130 typedef typename _Alloc_traits::pointer pointer;
131 typedef typename _Alloc_traits::const_pointer const_pointer;
132 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
133 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
139 static const size_type
npos =
static_cast<size_type
>(-1);
143#if __cplusplus < 201103L
144 typedef iterator __const_iterator;
146 typedef const_iterator __const_iterator;
150#if __cplusplus >= 201703L
152 typedef basic_string_view<_CharT, _Traits> __sv_type;
154 template<
typename _Tp,
typename _Res>
156 __and_<is_convertible<const _Tp&, __sv_type>,
157 __not_<is_convertible<const _Tp*, const basic_string*>>,
158 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
164 _S_to_string_view(__sv_type __svt)
noexcept
173 _GLIBCXX20_CONSTEXPR
explicit
174 __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
192 struct _Alloc_hider : allocator_type
194#if __cplusplus < 201103L
195 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
196 : allocator_type(__a), _M_p(__dat) { }
199 _Alloc_hider(pointer __dat,
const _Alloc& __a)
200 : allocator_type(__a), _M_p(__dat) { }
203 _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc())
204 : allocator_type(
std::
move(__a)), _M_p(__dat) { }
210 _Alloc_hider _M_dataplus;
211 size_type _M_string_length;
213 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
217 _CharT _M_local_buf[_S_local_capacity + 1];
218 size_type _M_allocated_capacity;
224 { _M_dataplus._M_p = __p; }
228 _M_length(size_type __length)
229 { _M_string_length = __length; }
234 {
return _M_dataplus._M_p; }
240#if __cplusplus >= 201103L
243 return pointer(_M_local_buf);
249 _M_local_data()
const
251#if __cplusplus >= 201103L
254 return const_pointer(_M_local_buf);
260 _M_capacity(size_type __capacity)
261 { _M_allocated_capacity = __capacity; }
265 _M_set_length(size_type __n)
268 traits_type::assign(_M_data()[__n], _CharT());
275 if (_M_data() == _M_local_data())
277 if (_M_string_length > _S_local_capacity)
278 __builtin_unreachable();
287 _M_create(size_type&, size_type);
294 _M_destroy(_M_allocated_capacity);
299 _M_destroy(size_type __size)
throw()
300 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
302#if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
305 template<
typename _InIterator>
307 _M_construct_aux(_InIterator __beg, _InIterator __end,
310 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
311 _M_construct(__beg, __end, _Tag());
316 template<
typename _Integer>
318 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
319 { _M_construct_aux_2(
static_cast<size_type
>(__beg), __end); }
322 _M_construct_aux_2(size_type __req, _CharT __c)
323 { _M_construct(__req, __c); }
327 template<
typename _InIterator>
330 _M_construct(_InIterator __beg, _InIterator __end,
335 template<
typename _FwdIterator>
338 _M_construct(_FwdIterator __beg, _FwdIterator __end,
343 _M_construct(size_type __req, _CharT __c);
348 {
return _M_dataplus; }
351 const allocator_type&
352 _M_get_allocator()
const
353 {
return _M_dataplus; }
356 __attribute__((__always_inline__))
359 _M_use_local_data() _GLIBCXX_NOEXCEPT
361#if __cpp_lib_is_constant_evaluated
363 for (size_type __i = 0; __i <= _S_local_capacity; ++__i)
364 _M_local_buf[__i] = _CharT();
366 return _M_local_data();
371#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
374 template<
typename _Tp,
bool _Requires =
375 !__are_same<_Tp, _CharT*>::__value
376 && !__are_same<_Tp, const _CharT*>::__value
377 && !__are_same<_Tp, iterator>::__value
378 && !__are_same<_Tp, const_iterator>::__value>
379 struct __enable_if_not_native_iterator
380 {
typedef basic_string& __type; };
381 template<
typename _Tp>
382 struct __enable_if_not_native_iterator<_Tp, false> { };
387 _M_check(size_type __pos,
const char* __s)
const
389 if (__pos > this->
size())
390 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > "
391 "this->size() (which is %zu)"),
392 __s, __pos, this->
size());
398 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
401 __throw_length_error(__N(__s));
408 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
410 const bool __testoff = __off < this->
size() - __pos;
411 return __testoff ? __off : this->
size() - __pos;
416 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
418 return (less<const _CharT*>()(__s, _M_data())
419 || less<const _CharT*>()(_M_data() + this->
size(), __s));
426 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
429 traits_type::assign(*__d, *__s);
431 traits_type::copy(__d, __s, __n);
436 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
439 traits_type::assign(*__d, *__s);
441 traits_type::move(__d, __s, __n);
446 _S_assign(_CharT* __d, size_type __n, _CharT __c)
449 traits_type::assign(*__d, __c);
451 traits_type::assign(__d, __n, __c);
456 template<
class _Iterator>
459 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
461 for (; __k1 != __k2; ++__k1, (void)++__p)
462 traits_type::assign(*__p, *__k1);
467 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
468 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
472 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
474 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
478 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
479 { _S_copy(__p, __k1, __k2 - __k1); }
483 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
485 { _S_copy(__p, __k1, __k2 - __k1); }
489 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
491 const difference_type __d = difference_type(__n1 - __n2);
493 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
494 return __gnu_cxx::__numeric_traits<int>::__max;
495 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
496 return __gnu_cxx::__numeric_traits<int>::__min;
507 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
512 _M_erase(size_type __pos, size_type __n);
524 _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value)
525 : _M_dataplus(_M_local_data())
537 : _M_dataplus(_M_local_data(), __a)
549 : _M_dataplus(_M_local_data(),
550 _Alloc_traits::_S_select_on_copy(__str._M_get_allocator()))
552 _M_construct(__str._M_data(), __str._M_data() + __str.length(),
566 const _Alloc& __a = _Alloc())
567 : _M_dataplus(_M_local_data(), __a)
569 const _CharT* __start = __str._M_data()
570 + __str._M_check(__pos,
"basic_string::basic_string");
571 _M_construct(__start, __start + __str._M_limit(__pos,
npos),
584 : _M_dataplus(_M_local_data())
586 const _CharT* __start = __str._M_data()
587 + __str._M_check(__pos,
"basic_string::basic_string");
588 _M_construct(__start, __start + __str._M_limit(__pos, __n),
601 size_type __n,
const _Alloc& __a)
602 : _M_dataplus(_M_local_data(), __a)
604 const _CharT* __start
605 = __str._M_data() + __str._M_check(__pos,
"string::string");
606 _M_construct(__start, __start + __str._M_limit(__pos, __n),
621 const _Alloc& __a = _Alloc())
622 : _M_dataplus(_M_local_data(), __a)
625 if (__s == 0 && __n > 0)
626 std::__throw_logic_error(__N(
"basic_string: "
627 "construction from null is not valid"));
636#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
639 template<
typename = _RequireAllocator<_Alloc>>
642 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc())
643 : _M_dataplus(_M_local_data(), __a)
647 std::__throw_logic_error(__N(
"basic_string: "
648 "construction from null is not valid"));
649 const _CharT* __end = __s + traits_type::length(__s);
650 _M_construct(__s, __end, forward_iterator_tag());
659#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
662 template<
typename = _RequireAllocator<_Alloc>>
665 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc())
666 : _M_dataplus(_M_local_data(), __a)
667 { _M_construct(__n, __c); }
669#if __cplusplus >= 201103L
679 : _M_dataplus(_M_local_data(),
std::move(__str._M_get_allocator()))
681 if (__str._M_is_local())
683 traits_type::copy(_M_local_buf, __str._M_local_buf,
688 _M_data(__str._M_data());
689 _M_capacity(__str._M_allocated_capacity);
695 _M_length(__str.length());
696 __str._M_data(__str._M_local_data());
697 __str._M_set_length(0);
706 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
707 : _M_dataplus(_M_local_data(), __a)
712 : _M_dataplus(_M_local_data(), __a)
717 noexcept(_Alloc_traits::_S_always_equal())
718 : _M_dataplus(_M_local_data(), __a)
720 if (__str._M_is_local())
722 traits_type::copy(_M_local_buf, __str._M_local_buf,
724 _M_length(__str.length());
725 __str._M_set_length(0);
727 else if (_Alloc_traits::_S_always_equal()
728 || __str.get_allocator() == __a)
730 _M_data(__str._M_data());
731 _M_length(__str.length());
732 _M_capacity(__str._M_allocated_capacity);
733 __str._M_data(__str._M_local_buf);
734 __str._M_set_length(0);
741#if __cplusplus >= 202100L
752#if __cplusplus >= 201103L
753 template<
typename _InputIterator,
754 typename = std::_RequireInputIter<_InputIterator>>
756 template<
typename _InputIterator>
759 basic_string(_InputIterator __beg, _InputIterator __end,
760 const _Alloc& __a = _Alloc())
761 : _M_dataplus(_M_local_data(), __a), _M_string_length(0)
763#if __cplusplus >= 201103L
766 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
767 _M_construct_aux(__beg, __end, _Integral());
771#if __cplusplus >= 201703L
779 template<
typename _Tp,
780 typename = enable_if_t<is_convertible_v<const _Tp&, __sv_type>>>
782 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
783 const _Alloc& __a = _Alloc())
791 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
794 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
795 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
813 return this->
assign(__str);
823 {
return this->
assign(__s); }
840#if __cplusplus >= 201103L
853 noexcept(_Alloc_traits::_S_nothrow_move())
855 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
856 && !_Alloc_traits::_S_always_equal()
857 && _M_get_allocator() != __str._M_get_allocator())
860 _M_destroy(_M_allocated_capacity);
861 _M_data(_M_local_data());
865 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
867 if (__str._M_is_local())
875 this->_S_copy(_M_data(), __str._M_data(), __str.size());
876 _M_set_length(__str.size());
879 else if (_Alloc_traits::_S_propagate_on_move_assign()
880 || _Alloc_traits::_S_always_equal()
881 || _M_get_allocator() == __str._M_get_allocator())
884 pointer __data =
nullptr;
885 size_type __capacity;
888 if (_Alloc_traits::_S_always_equal())
892 __capacity = _M_allocated_capacity;
895 _M_destroy(_M_allocated_capacity);
898 _M_data(__str._M_data());
899 _M_length(__str.length());
900 _M_capacity(__str._M_allocated_capacity);
903 __str._M_data(__data);
904 __str._M_capacity(__capacity);
907 __str._M_data(__str._M_local_buf);
923 this->
assign(__l.begin(), __l.size());
928#if __cplusplus >= 201703L
933 template<
typename _Tp>
935 _If_sv<_Tp, basic_string&>
937 {
return this->
assign(__svt); }
944 operator __sv_type() const noexcept
945 {
return __sv_type(
data(),
size()); }
955 begin() _GLIBCXX_NOEXCEPT
956 {
return iterator(_M_data()); }
964 begin() const _GLIBCXX_NOEXCEPT
965 {
return const_iterator(_M_data()); }
973 end() _GLIBCXX_NOEXCEPT
974 {
return iterator(_M_data() + this->
size()); }
982 end() const _GLIBCXX_NOEXCEPT
983 {
return const_iterator(_M_data() + this->
size()); }
992 rbegin() _GLIBCXX_NOEXCEPT
993 {
return reverse_iterator(this->
end()); }
1000 _GLIBCXX20_CONSTEXPR
1001 const_reverse_iterator
1002 rbegin() const _GLIBCXX_NOEXCEPT
1003 {
return const_reverse_iterator(this->
end()); }
1010 _GLIBCXX20_CONSTEXPR
1012 rend() _GLIBCXX_NOEXCEPT
1013 {
return reverse_iterator(this->
begin()); }
1020 _GLIBCXX20_CONSTEXPR
1021 const_reverse_iterator
1022 rend() const _GLIBCXX_NOEXCEPT
1023 {
return const_reverse_iterator(this->
begin()); }
1025#if __cplusplus >= 201103L
1030 _GLIBCXX20_CONSTEXPR
1033 {
return const_iterator(this->_M_data()); }
1039 _GLIBCXX20_CONSTEXPR
1041 cend() const noexcept
1042 {
return const_iterator(this->_M_data() + this->
size()); }
1049 _GLIBCXX20_CONSTEXPR
1050 const_reverse_iterator
1052 {
return const_reverse_iterator(this->
end()); }
1059 _GLIBCXX20_CONSTEXPR
1060 const_reverse_iterator
1061 crend() const noexcept
1062 {
return const_reverse_iterator(this->
begin()); }
1069 _GLIBCXX20_CONSTEXPR
1071 size() const _GLIBCXX_NOEXCEPT
1072 {
return _M_string_length; }
1076 _GLIBCXX20_CONSTEXPR
1078 length() const _GLIBCXX_NOEXCEPT
1079 {
return _M_string_length; }
1082 _GLIBCXX20_CONSTEXPR
1085 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
1097 _GLIBCXX20_CONSTEXPR
1099 resize(size_type __n, _CharT __c);
1111 _GLIBCXX20_CONSTEXPR
1114 { this->
resize(__n, _CharT()); }
1116#if __cplusplus >= 201103L
1117#pragma GCC diagnostic push
1118#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1120 _GLIBCXX20_CONSTEXPR
1124#pragma GCC diagnostic pop
1127#if __cplusplus > 202002L
1128#define __cpp_lib_string_resize_and_overwrite 202110L
1129 template<
typename _Operation>
1131 resize_and_overwrite(size_type __n, _Operation __op);
1138 _GLIBCXX20_CONSTEXPR
1142 return _M_is_local() ? size_type(_S_local_capacity)
1143 : _M_allocated_capacity;
1163 _GLIBCXX20_CONSTEXPR
1170#if __cplusplus > 201703L
1171 [[deprecated(
"use shrink_to_fit() instead")]]
1173 _GLIBCXX20_CONSTEXPR
1180 _GLIBCXX20_CONSTEXPR
1182 clear() _GLIBCXX_NOEXCEPT
1183 { _M_set_length(0); }
1189 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1191 empty() const _GLIBCXX_NOEXCEPT
1192 {
return this->
size() == 0; }
1205 _GLIBCXX20_CONSTEXPR
1207 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
1209 __glibcxx_assert(__pos <=
size());
1210 return _M_data()[__pos];
1223 _GLIBCXX20_CONSTEXPR
1229 __glibcxx_assert(__pos <=
size());
1231 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1232 return _M_data()[__pos];
1245 _GLIBCXX20_CONSTEXPR
1247 at(size_type __n)
const
1249 if (__n >= this->
size())
1250 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1251 "(which is %zu) >= this->size() "
1254 return _M_data()[__n];
1267 _GLIBCXX20_CONSTEXPR
1272 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1273 "(which is %zu) >= this->size() "
1276 return _M_data()[__n];
1279#if __cplusplus >= 201103L
1284 _GLIBCXX20_CONSTEXPR
1288 __glibcxx_assert(!
empty());
1296 _GLIBCXX20_CONSTEXPR
1298 front() const noexcept
1300 __glibcxx_assert(!
empty());
1308 _GLIBCXX20_CONSTEXPR
1312 __glibcxx_assert(!
empty());
1320 _GLIBCXX20_CONSTEXPR
1322 back() const noexcept
1324 __glibcxx_assert(!
empty());
1335 _GLIBCXX20_CONSTEXPR
1338 {
return this->
append(__str); }
1345 _GLIBCXX20_CONSTEXPR
1348 {
return this->
append(__s); }
1355 _GLIBCXX20_CONSTEXPR
1363#if __cplusplus >= 201103L
1369 _GLIBCXX20_CONSTEXPR
1372 {
return this->
append(__l.begin(), __l.size()); }
1375#if __cplusplus >= 201703L
1381 template<
typename _Tp>
1382 _GLIBCXX20_CONSTEXPR
1383 _If_sv<_Tp, basic_string&>
1385 {
return this->
append(__svt); }
1393 _GLIBCXX20_CONSTEXPR
1396 {
return this->
append(__str._M_data(), __str.size()); }
1411 _GLIBCXX20_CONSTEXPR
1414 {
return this->
append(__str._M_data()
1415 + __str._M_check(__pos,
"basic_string::append"),
1416 __str._M_limit(__pos, __n)); }
1424 _GLIBCXX20_CONSTEXPR
1426 append(
const _CharT* __s, size_type __n)
1428 __glibcxx_requires_string_len(__s, __n);
1429 _M_check_length(size_type(0), __n,
"basic_string::append");
1430 return _M_append(__s, __n);
1438 _GLIBCXX20_CONSTEXPR
1440 append(
const _CharT* __s)
1442 __glibcxx_requires_string(__s);
1443 const size_type __n = traits_type::length(__s);
1444 _M_check_length(size_type(0), __n,
"basic_string::append");
1445 return _M_append(__s, __n);
1456 _GLIBCXX20_CONSTEXPR
1458 append(size_type __n, _CharT __c)
1459 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1461#if __cplusplus >= 201103L
1467 _GLIBCXX20_CONSTEXPR
1469 append(initializer_list<_CharT> __l)
1470 {
return this->
append(__l.begin(), __l.size()); }
1481#if __cplusplus >= 201103L
1482 template<
class _InputIterator,
1483 typename = std::_RequireInputIter<_InputIterator>>
1484 _GLIBCXX20_CONSTEXPR
1486 template<
class _InputIterator>
1489 append(_InputIterator __first, _InputIterator __last)
1492#if __cplusplus >= 201703L
1498 template<
typename _Tp>
1499 _GLIBCXX20_CONSTEXPR
1500 _If_sv<_Tp, basic_string&>
1503 __sv_type __sv = __svt;
1504 return this->
append(__sv.data(), __sv.size());
1514 template<
typename _Tp>
1515 _GLIBCXX20_CONSTEXPR
1516 _If_sv<_Tp, basic_string&>
1517 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1519 __sv_type __sv = __svt;
1520 return _M_append(__sv.data()
1521 + std::__sv_check(__sv.size(), __pos,
"basic_string::append"),
1522 std::__sv_limit(__sv.size(), __pos, __n));
1530 _GLIBCXX20_CONSTEXPR
1534 const size_type __size = this->
size();
1536 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1537 traits_type::assign(this->_M_data()[__size], __c);
1538 this->_M_set_length(__size + 1);
1546 _GLIBCXX20_CONSTEXPR
1550#if __cplusplus >= 201103L
1551 if (_Alloc_traits::_S_propagate_on_copy_assign())
1553 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
1554 && _M_get_allocator() != __str._M_get_allocator())
1558 if (__str.size() <= _S_local_capacity)
1560 _M_destroy(_M_allocated_capacity);
1561 _M_data(_M_use_local_data());
1566 const auto __len = __str.size();
1567 auto __alloc = __str._M_get_allocator();
1569 auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
1570 _M_destroy(_M_allocated_capacity);
1573 _M_set_length(__len);
1576 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
1579 this->_M_assign(__str);
1583#if __cplusplus >= 201103L
1592 _GLIBCXX20_CONSTEXPR
1595 noexcept(_Alloc_traits::_S_nothrow_move())
1616 _GLIBCXX20_CONSTEXPR
1619 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1620 + __str._M_check(__pos,
"basic_string::assign"),
1621 __str._M_limit(__pos, __n)); }
1633 _GLIBCXX20_CONSTEXPR
1635 assign(
const _CharT* __s, size_type __n)
1637 __glibcxx_requires_string_len(__s, __n);
1638 return _M_replace(size_type(0), this->
size(), __s, __n);
1650 _GLIBCXX20_CONSTEXPR
1652 assign(
const _CharT* __s)
1654 __glibcxx_requires_string(__s);
1655 return _M_replace(size_type(0), this->
size(), __s,
1656 traits_type::length(__s));
1668 _GLIBCXX20_CONSTEXPR
1670 assign(size_type __n, _CharT __c)
1671 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1681#if __cplusplus >= 201103L
1682 template<
class _InputIterator,
1683 typename = std::_RequireInputIter<_InputIterator>>
1684 _GLIBCXX20_CONSTEXPR
1686 template<
class _InputIterator>
1689 assign(_InputIterator __first, _InputIterator __last)
1692#if __cplusplus >= 201103L
1698 _GLIBCXX20_CONSTEXPR
1700 assign(initializer_list<_CharT> __l)
1701 {
return this->
assign(__l.begin(), __l.size()); }
1704#if __cplusplus >= 201703L
1710 template<
typename _Tp>
1711 _GLIBCXX20_CONSTEXPR
1712 _If_sv<_Tp, basic_string&>
1715 __sv_type __sv = __svt;
1716 return this->
assign(__sv.data(), __sv.size());
1726 template<
typename _Tp>
1727 _GLIBCXX20_CONSTEXPR
1728 _If_sv<_Tp, basic_string&>
1729 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1731 __sv_type __sv = __svt;
1732 return _M_replace(size_type(0), this->
size(),
1734 + std::__sv_check(__sv.size(), __pos,
"basic_string::assign"),
1735 std::__sv_limit(__sv.size(), __pos, __n));
1739#if __cplusplus >= 201103L
1755 _GLIBCXX20_CONSTEXPR
1757 insert(const_iterator __p, size_type __n, _CharT __c)
1759 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1760 const size_type __pos = __p -
begin();
1761 this->
replace(__p, __p, __n, __c);
1762 return iterator(this->_M_data() + __pos);
1779 insert(iterator __p, size_type __n, _CharT __c)
1780 { this->
replace(__p, __p, __n, __c); }
1783#if __cplusplus >= 201103L
1798 template<
class _InputIterator,
1799 typename = std::_RequireInputIter<_InputIterator>>
1800 _GLIBCXX20_CONSTEXPR
1802 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1804 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1805 const size_type __pos = __p -
begin();
1806 this->
replace(__p, __p, __beg, __end);
1807 return iterator(this->_M_data() + __pos);
1822 template<
class _InputIterator>
1824 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1825 { this->
replace(__p, __p, __beg, __end); }
1828#if __cplusplus >= 201103L
1835 _GLIBCXX20_CONSTEXPR
1837 insert(const_iterator __p, initializer_list<_CharT> __l)
1838 {
return this->
insert(__p, __l.begin(), __l.end()); }
1840#ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
1843 insert(iterator __p, initializer_list<_CharT> __l)
1845 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1846 this->
insert(__p -
begin(), __l.begin(), __l.size());
1863 _GLIBCXX20_CONSTEXPR
1866 {
return this->
replace(__pos1, size_type(0),
1867 __str._M_data(), __str.size()); }
1887 _GLIBCXX20_CONSTEXPR
1890 size_type __pos2, size_type __n =
npos)
1891 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1892 + __str._M_check(__pos2,
"basic_string::insert"),
1893 __str._M_limit(__pos2, __n)); }
1911 _GLIBCXX20_CONSTEXPR
1913 insert(size_type __pos,
const _CharT* __s, size_type __n)
1914 {
return this->
replace(__pos, size_type(0), __s, __n); }
1931 _GLIBCXX20_CONSTEXPR
1933 insert(size_type __pos,
const _CharT* __s)
1935 __glibcxx_requires_string(__s);
1936 return this->
replace(__pos, size_type(0), __s,
1937 traits_type::length(__s));
1956 _GLIBCXX20_CONSTEXPR
1958 insert(size_type __pos, size_type __n, _CharT __c)
1959 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1960 size_type(0), __n, __c); }
1975 _GLIBCXX20_CONSTEXPR
1977 insert(__const_iterator __p, _CharT __c)
1979 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1980 const size_type __pos = __p -
begin();
1981 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1982 return iterator(_M_data() + __pos);
1985#if __cplusplus >= 201703L
1992 template<
typename _Tp>
1993 _GLIBCXX20_CONSTEXPR
1994 _If_sv<_Tp, basic_string&>
1995 insert(size_type __pos,
const _Tp& __svt)
1997 __sv_type __sv = __svt;
1998 return this->
insert(__pos, __sv.data(), __sv.size());
2009 template<
typename _Tp>
2010 _GLIBCXX20_CONSTEXPR
2011 _If_sv<_Tp, basic_string&>
2012 insert(size_type __pos1,
const _Tp& __svt,
2013 size_type __pos2, size_type __n =
npos)
2015 __sv_type __sv = __svt;
2016 return this->
replace(__pos1, size_type(0),
2018 + std::__sv_check(__sv.size(), __pos2,
"basic_string::insert"),
2019 std::__sv_limit(__sv.size(), __pos2, __n));
2038 _GLIBCXX20_CONSTEXPR
2040 erase(size_type __pos = 0, size_type __n =
npos)
2042 _M_check(__pos,
"basic_string::erase");
2044 this->_M_set_length(__pos);
2046 this->_M_erase(__pos, _M_limit(__pos, __n));
2058 _GLIBCXX20_CONSTEXPR
2060 erase(__const_iterator __position)
2062 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
2063 && __position <
end());
2064 const size_type __pos = __position -
begin();
2065 this->_M_erase(__pos, size_type(1));
2066 return iterator(_M_data() + __pos);
2078 _GLIBCXX20_CONSTEXPR
2080 erase(__const_iterator __first, __const_iterator __last)
2082 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
2083 && __last <=
end());
2084 const size_type __pos = __first -
begin();
2085 if (__last ==
end())
2086 this->_M_set_length(__pos);
2088 this->_M_erase(__pos, __last - __first);
2089 return iterator(this->_M_data() + __pos);
2092#if __cplusplus >= 201103L
2098 _GLIBCXX20_CONSTEXPR
2102 __glibcxx_assert(!
empty());
2103 _M_erase(
size() - 1, 1);
2124 _GLIBCXX20_CONSTEXPR
2127 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
2147 _GLIBCXX20_CONSTEXPR
2150 size_type __pos2, size_type __n2 =
npos)
2151 {
return this->
replace(__pos1, __n1, __str._M_data()
2152 + __str._M_check(__pos2,
"basic_string::replace"),
2153 __str._M_limit(__pos2, __n2)); }
2173 _GLIBCXX20_CONSTEXPR
2175 replace(size_type __pos, size_type __n1,
const _CharT* __s,
2178 __glibcxx_requires_string_len(__s, __n2);
2179 return _M_replace(_M_check(__pos,
"basic_string::replace"),
2180 _M_limit(__pos, __n1), __s, __n2);
2199 _GLIBCXX20_CONSTEXPR
2201 replace(size_type __pos, size_type __n1,
const _CharT* __s)
2203 __glibcxx_requires_string(__s);
2204 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
2224 _GLIBCXX20_CONSTEXPR
2226 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
2227 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
2228 _M_limit(__pos, __n1), __n2, __c); }
2243 _GLIBCXX20_CONSTEXPR
2245 replace(__const_iterator __i1, __const_iterator __i2,
2247 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
2264 _GLIBCXX20_CONSTEXPR
2266 replace(__const_iterator __i1, __const_iterator __i2,
2267 const _CharT* __s, size_type __n)
2269 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2271 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2287 _GLIBCXX20_CONSTEXPR
2289 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2291 __glibcxx_requires_string(__s);
2292 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2309 _GLIBCXX20_CONSTEXPR
2311 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2314 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2316 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2334#if __cplusplus >= 201103L
2335 template<
class _InputIterator,
2336 typename = std::_RequireInputIter<_InputIterator>>
2337 _GLIBCXX20_CONSTEXPR
2339 replace(const_iterator __i1, const_iterator __i2,
2340 _InputIterator __k1, _InputIterator __k2)
2342 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2344 __glibcxx_requires_valid_range(__k1, __k2);
2345 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2346 std::__false_type());
2349 template<
class _InputIterator>
2350#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
2351 typename __enable_if_not_native_iterator<_InputIterator>::__type
2355 replace(iterator __i1, iterator __i2,
2356 _InputIterator __k1, _InputIterator __k2)
2358 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2360 __glibcxx_requires_valid_range(__k1, __k2);
2361 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2362 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2368 _GLIBCXX20_CONSTEXPR
2370 replace(__const_iterator __i1, __const_iterator __i2,
2371 _CharT* __k1, _CharT* __k2)
2373 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2375 __glibcxx_requires_valid_range(__k1, __k2);
2380 _GLIBCXX20_CONSTEXPR
2382 replace(__const_iterator __i1, __const_iterator __i2,
2383 const _CharT* __k1,
const _CharT* __k2)
2385 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2387 __glibcxx_requires_valid_range(__k1, __k2);
2392 _GLIBCXX20_CONSTEXPR
2394 replace(__const_iterator __i1, __const_iterator __i2,
2395 iterator __k1, iterator __k2)
2397 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2399 __glibcxx_requires_valid_range(__k1, __k2);
2401 __k1.base(), __k2 - __k1);
2404 _GLIBCXX20_CONSTEXPR
2406 replace(__const_iterator __i1, __const_iterator __i2,
2407 const_iterator __k1, const_iterator __k2)
2409 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2411 __glibcxx_requires_valid_range(__k1, __k2);
2413 __k1.base(), __k2 - __k1);
2416#if __cplusplus >= 201103L
2431 _GLIBCXX20_CONSTEXPR
2433 initializer_list<_CharT> __l)
2434 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2437#if __cplusplus >= 201703L
2445 template<
typename _Tp>
2446 _GLIBCXX20_CONSTEXPR
2447 _If_sv<_Tp, basic_string&>
2448 replace(size_type __pos, size_type __n,
const _Tp& __svt)
2450 __sv_type __sv = __svt;
2451 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2463 template<
typename _Tp>
2464 _GLIBCXX20_CONSTEXPR
2465 _If_sv<_Tp, basic_string&>
2466 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2467 size_type __pos2, size_type __n2 =
npos)
2469 __sv_type __sv = __svt;
2470 return this->
replace(__pos1, __n1,
2472 + std::__sv_check(__sv.size(), __pos2,
"basic_string::replace"),
2473 std::__sv_limit(__sv.size(), __pos2, __n2));
2485 template<
typename _Tp>
2486 _GLIBCXX20_CONSTEXPR
2487 _If_sv<_Tp, basic_string&>
2488 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2490 __sv_type __sv = __svt;
2491 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2496 template<
class _Integer>
2497 _GLIBCXX20_CONSTEXPR
2499 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2500 _Integer __n, _Integer __val, __true_type)
2501 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2503 template<
class _InputIterator>
2504 _GLIBCXX20_CONSTEXPR
2506 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2507 _InputIterator __k1, _InputIterator __k2,
2510 _GLIBCXX20_CONSTEXPR
2512 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2515 _GLIBCXX20_CONSTEXPR
2517 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2518 const size_type __len2);
2520 _GLIBCXX20_CONSTEXPR
2522 _M_append(
const _CharT* __s, size_type __n);
2538 _GLIBCXX20_CONSTEXPR
2540 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2549 _GLIBCXX20_CONSTEXPR
2560 _GLIBCXX20_CONSTEXPR
2562 c_str() const _GLIBCXX_NOEXCEPT
2563 {
return _M_data(); }
2573 _GLIBCXX20_CONSTEXPR
2575 data() const _GLIBCXX_NOEXCEPT
2576 {
return _M_data(); }
2578#if __cplusplus >= 201703L
2585 _GLIBCXX20_CONSTEXPR
2588 {
return _M_data(); }
2594 _GLIBCXX20_CONSTEXPR
2597 {
return _M_get_allocator(); }
2611 _GLIBCXX20_CONSTEXPR
2613 find(
const _CharT* __s, size_type __pos, size_type __n)
const
2626 _GLIBCXX20_CONSTEXPR
2630 {
return this->
find(__str.data(), __pos, __str.size()); }
2632#if __cplusplus >= 201703L
2639 template<
typename _Tp>
2640 _GLIBCXX20_CONSTEXPR
2641 _If_sv<_Tp, size_type>
2642 find(
const _Tp& __svt, size_type __pos = 0) const
2643 noexcept(is_same<_Tp, __sv_type>::value)
2645 __sv_type __sv = __svt;
2646 return this->
find(__sv.data(), __pos, __sv.size());
2660 _GLIBCXX20_CONSTEXPR
2662 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2664 __glibcxx_requires_string(__s);
2665 return this->
find(__s, __pos, traits_type::length(__s));
2678 _GLIBCXX20_CONSTEXPR
2680 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
2692 _GLIBCXX20_CONSTEXPR
2696 {
return this->
rfind(__str.data(), __pos, __str.size()); }
2698#if __cplusplus >= 201703L
2705 template<
typename _Tp>
2706 _GLIBCXX20_CONSTEXPR
2707 _If_sv<_Tp, size_type>
2708 rfind(
const _Tp& __svt, size_type __pos =
npos)
const
2709 noexcept(is_same<_Tp, __sv_type>::value)
2711 __sv_type __sv = __svt;
2712 return this->
rfind(__sv.data(), __pos, __sv.size());
2728 _GLIBCXX20_CONSTEXPR
2730 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
2743 _GLIBCXX20_CONSTEXPR
2745 rfind(
const _CharT* __s, size_type __pos =
npos)
const
2747 __glibcxx_requires_string(__s);
2748 return this->
rfind(__s, __pos, traits_type::length(__s));
2761 _GLIBCXX20_CONSTEXPR
2763 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
2776 _GLIBCXX20_CONSTEXPR
2780 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2782#if __cplusplus >= 201703L
2790 template<
typename _Tp>
2791 _GLIBCXX20_CONSTEXPR
2792 _If_sv<_Tp, size_type>
2794 noexcept(is_same<_Tp, __sv_type>::value)
2796 __sv_type __sv = __svt;
2797 return this->
find_first_of(__sv.data(), __pos, __sv.size());
2813 _GLIBCXX20_CONSTEXPR
2815 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2828 _GLIBCXX20_CONSTEXPR
2833 __glibcxx_requires_string(__s);
2834 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2849 _GLIBCXX20_CONSTEXPR
2851 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2852 {
return this->
find(__c, __pos); }
2865 _GLIBCXX20_CONSTEXPR
2869 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2871#if __cplusplus >= 201703L
2879 template<
typename _Tp>
2880 _GLIBCXX20_CONSTEXPR
2881 _If_sv<_Tp, size_type>
2883 noexcept(is_same<_Tp, __sv_type>::value)
2885 __sv_type __sv = __svt;
2886 return this->
find_last_of(__sv.data(), __pos, __sv.size());
2902 _GLIBCXX20_CONSTEXPR
2904 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2917 _GLIBCXX20_CONSTEXPR
2922 __glibcxx_requires_string(__s);
2923 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2938 _GLIBCXX20_CONSTEXPR
2941 {
return this->
rfind(__c, __pos); }
2953 _GLIBCXX20_CONSTEXPR
2959#if __cplusplus >= 201703L
2967 template<
typename _Tp>
2968 _If_sv<_Tp, size_type>
2969 _GLIBCXX20_CONSTEXPR
2971 noexcept(is_same<_Tp, __sv_type>::value)
2973 __sv_type __sv = __svt;
2990 _GLIBCXX20_CONSTEXPR
2993 size_type __n)
const _GLIBCXX_NOEXCEPT;
3005 _GLIBCXX20_CONSTEXPR
3010 __glibcxx_requires_string(__s);
3024 _GLIBCXX20_CONSTEXPR
3040 _GLIBCXX20_CONSTEXPR
3046#if __cplusplus >= 201703L
3054 template<
typename _Tp>
3055 _GLIBCXX20_CONSTEXPR
3056 _If_sv<_Tp, size_type>
3058 noexcept(is_same<_Tp, __sv_type>::value)
3060 __sv_type __sv = __svt;
3077 _GLIBCXX20_CONSTEXPR
3080 size_type __n)
const _GLIBCXX_NOEXCEPT;
3092 _GLIBCXX20_CONSTEXPR
3097 __glibcxx_requires_string(__s);
3111 _GLIBCXX20_CONSTEXPR
3128 _GLIBCXX20_CONSTEXPR
3130 substr(size_type __pos = 0, size_type __n =
npos)
const
3132 _M_check(__pos,
"basic_string::substr"), __n); }
3148 _GLIBCXX20_CONSTEXPR
3152 const size_type __size = this->
size();
3153 const size_type __osize = __str.size();
3154 const size_type __len =
std::min(__size, __osize);
3156 int __r = traits_type::compare(_M_data(), __str.data(), __len);
3158 __r = _S_compare(__size, __osize);
3162#if __cplusplus >= 201703L
3168 template<
typename _Tp>
3169 _GLIBCXX20_CONSTEXPR
3171 compare(
const _Tp& __svt)
const
3172 noexcept(is_same<_Tp, __sv_type>::value)
3174 __sv_type __sv = __svt;
3175 const size_type __size = this->
size();
3176 const size_type __osize = __sv.size();
3177 const size_type __len =
std::min(__size, __osize);
3179 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
3181 __r = _S_compare(__size, __osize);
3193 template<
typename _Tp>
3194 _GLIBCXX20_CONSTEXPR
3196 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const
3197 noexcept(is_same<_Tp, __sv_type>::value)
3199 __sv_type __sv = __svt;
3200 return __sv_type(*this).substr(__pos, __n).compare(__sv);
3213 template<
typename _Tp>
3214 _GLIBCXX20_CONSTEXPR
3216 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
3217 size_type __pos2, size_type __n2 =
npos)
const
3218 noexcept(is_same<_Tp, __sv_type>::value)
3220 __sv_type __sv = __svt;
3221 return __sv_type(*
this)
3222 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
3245 _GLIBCXX20_CONSTEXPR
3272 _GLIBCXX20_CONSTEXPR
3275 size_type __pos2, size_type __n2 =
npos)
const;
3291 _GLIBCXX20_CONSTEXPR
3293 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
3316 _GLIBCXX20_CONSTEXPR
3318 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
3344 _GLIBCXX20_CONSTEXPR
3346 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3347 size_type __n2)
const;
3349#if __cplusplus >= 202002L
3351 starts_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3352 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3355 starts_with(_CharT __x)
const noexcept
3356 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3359 starts_with(
const _CharT* __x)
const noexcept
3360 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3363 ends_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3364 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3367 ends_with(_CharT __x)
const noexcept
3368 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3371 ends_with(
const _CharT* __x)
const noexcept
3372 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3375#if __cplusplus > 202002L
3377 contains(basic_string_view<_CharT, _Traits> __x)
const noexcept
3378 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3381 contains(_CharT __x)
const noexcept
3382 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3385 contains(
const _CharT* __x)
const noexcept
3386 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3390 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3392_GLIBCXX_END_NAMESPACE_CXX11
3393_GLIBCXX_END_NAMESPACE_VERSION
3397namespace std _GLIBCXX_VISIBILITY(default)
3399_GLIBCXX_BEGIN_NAMESPACE_VERSION
3401#if __cpp_deduction_guides >= 201606
3402_GLIBCXX_BEGIN_NAMESPACE_CXX11
3403 template<
typename _InputIterator,
typename _CharT
3404 =
typename iterator_traits<_InputIterator>::value_type,
3405 typename _Allocator = allocator<_CharT>,
3406 typename = _RequireInputIter<_InputIterator>,
3407 typename = _RequireAllocator<_Allocator>>
3408 basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
3409 -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
3413 template<
typename _CharT,
typename _Traits,
3414 typename _Allocator = allocator<_CharT>,
3415 typename = _RequireAllocator<_Allocator>>
3416 basic_string(basic_string_view<_CharT, _Traits>,
const _Allocator& = _Allocator())
3417 -> basic_string<_CharT, _Traits, _Allocator>;
3419 template<
typename _CharT,
typename _Traits,
3420 typename _Allocator = allocator<_CharT>,
3421 typename = _RequireAllocator<_Allocator>>
3422 basic_string(basic_string_view<_CharT, _Traits>,
3423 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3424 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3425 const _Allocator& = _Allocator())
3426 -> basic_string<_CharT, _Traits, _Allocator>;
3427_GLIBCXX_END_NAMESPACE_CXX11
3437 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3438 _GLIBCXX20_CONSTEXPR
3439 basic_string<_CharT, _Traits, _Alloc>
3444 __str.append(__rhs);
3454 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3455 _GLIBCXX20_CONSTEXPR
3456 basic_string<_CharT,_Traits,_Alloc>
3458 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3466 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3467 _GLIBCXX20_CONSTEXPR
3468 basic_string<_CharT,_Traits,_Alloc>
3469 operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3477 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3478 _GLIBCXX20_CONSTEXPR
3479 inline basic_string<_CharT, _Traits, _Alloc>
3481 const _CharT* __rhs)
3484 __str.append(__rhs);
3494 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3495 _GLIBCXX20_CONSTEXPR
3496 inline basic_string<_CharT, _Traits, _Alloc>
3500 typedef typename __string_type::size_type __size_type;
3501 __string_type __str(__lhs);
3502 __str.append(__size_type(1), __rhs);
3506#if __cplusplus >= 201103L
3507 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3508 _GLIBCXX20_CONSTEXPR
3509 inline basic_string<_CharT, _Traits, _Alloc>
3510 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3511 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
3512 {
return std::move(__lhs.append(__rhs)); }
3514 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3515 _GLIBCXX20_CONSTEXPR
3516 inline basic_string<_CharT, _Traits, _Alloc>
3517 operator+(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3518 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3519 {
return std::move(__rhs.insert(0, __lhs)); }
3521 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3522 _GLIBCXX20_CONSTEXPR
3523 inline basic_string<_CharT, _Traits, _Alloc>
3524 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3525 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3527#if _GLIBCXX_USE_CXX11_ABI
3528 using _Alloc_traits = allocator_traits<_Alloc>;
3529 bool __use_rhs =
false;
3530 if _GLIBCXX17_CONSTEXPR (
typename _Alloc_traits::is_always_equal{})
3532 else if (__lhs.get_allocator() == __rhs.get_allocator())
3537 const auto __size = __lhs.size() + __rhs.size();
3538 if (__size > __lhs.capacity() && __size <= __rhs.capacity())
3539 return std::move(__rhs.insert(0, __lhs));
3544 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3545 _GLIBCXX20_CONSTEXPR
3546 inline basic_string<_CharT, _Traits, _Alloc>
3548 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3549 {
return std::move(__rhs.insert(0, __lhs)); }
3551 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3552 _GLIBCXX20_CONSTEXPR
3553 inline basic_string<_CharT, _Traits, _Alloc>
3555 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3556 {
return std::move(__rhs.insert(0, 1, __lhs)); }
3558 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3559 _GLIBCXX20_CONSTEXPR
3560 inline basic_string<_CharT, _Traits, _Alloc>
3561 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3562 const _CharT* __rhs)
3563 {
return std::move(__lhs.append(__rhs)); }
3565 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3566 _GLIBCXX20_CONSTEXPR
3567 inline basic_string<_CharT, _Traits, _Alloc>
3568 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3570 {
return std::move(__lhs.append(1, __rhs)); }
3580 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3581 _GLIBCXX20_CONSTEXPR
3586 {
return __lhs.compare(__rhs) == 0; }
3588 template<
typename _CharT>
3589 _GLIBCXX20_CONSTEXPR
3591 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
3592 operator==(
const basic_string<_CharT>& __lhs,
3593 const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT
3594 {
return (__lhs.size() == __rhs.size()
3604 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3605 _GLIBCXX20_CONSTEXPR
3608 const _CharT* __rhs)
3609 {
return __lhs.compare(__rhs) == 0; }
3611#if __cpp_lib_three_way_comparison
3619 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3621 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3622 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
noexcept
3623 ->
decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3624 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3633 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3635 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3636 const _CharT* __rhs)
noexcept
3637 ->
decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3638 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3646 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3648 operator==(
const _CharT* __lhs,
3650 {
return __rhs.compare(__lhs) == 0; }
3659 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3664 {
return !(__lhs == __rhs); }
3672 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3674 operator!=(
const _CharT* __lhs,
3676 {
return !(__lhs == __rhs); }
3684 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3687 const _CharT* __rhs)
3688 {
return !(__lhs == __rhs); }
3697 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3702 {
return __lhs.compare(__rhs) < 0; }
3710 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3713 const _CharT* __rhs)
3714 {
return __lhs.compare(__rhs) < 0; }
3722 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3724 operator<(
const _CharT* __lhs,
3726 {
return __rhs.compare(__lhs) > 0; }
3735 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3740 {
return __lhs.compare(__rhs) > 0; }
3748 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3751 const _CharT* __rhs)
3752 {
return __lhs.compare(__rhs) > 0; }
3760 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3762 operator>(
const _CharT* __lhs,
3764 {
return __rhs.compare(__lhs) < 0; }
3773 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3778 {
return __lhs.compare(__rhs) <= 0; }
3786 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3789 const _CharT* __rhs)
3790 {
return __lhs.compare(__rhs) <= 0; }
3798 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3800 operator<=(
const _CharT* __lhs,
3802 {
return __rhs.compare(__lhs) >= 0; }
3811 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3816 {
return __lhs.compare(__rhs) >= 0; }
3824 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3827 const _CharT* __rhs)
3828 {
return __lhs.compare(__rhs) >= 0; }
3836 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3838 operator>=(
const _CharT* __lhs,
3840 {
return __rhs.compare(__lhs) <= 0; }
3850 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3851 _GLIBCXX20_CONSTEXPR
3855 _GLIBCXX_NOEXCEPT_IF(
noexcept(__lhs.swap(__rhs)))
3856 { __lhs.swap(__rhs); }
3871 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3872 basic_istream<_CharT, _Traits>&
3873 operator>>(basic_istream<_CharT, _Traits>& __is,
3874 basic_string<_CharT, _Traits, _Alloc>& __str);
3877 basic_istream<char>&
3889 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3896 return __ostream_insert(__os, __str.data(), __str.size());
3912 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3913 basic_istream<_CharT, _Traits>&
3914 getline(basic_istream<_CharT, _Traits>& __is,
3915 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
3929 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3930 inline basic_istream<_CharT, _Traits>&
3935#if __cplusplus >= 201103L
3937 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3938 inline basic_istream<_CharT, _Traits>&
3944 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3945 inline basic_istream<_CharT, _Traits>&
3952 basic_istream<char>&
3953 getline(basic_istream<char>& __in, basic_string<char>& __str,
3956#ifdef _GLIBCXX_USE_WCHAR_T
3958 basic_istream<wchar_t>&
3959 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
3963_GLIBCXX_END_NAMESPACE_VERSION
3966#if __cplusplus >= 201103L
3971namespace std _GLIBCXX_VISIBILITY(default)
3973_GLIBCXX_BEGIN_NAMESPACE_VERSION
3974_GLIBCXX_BEGIN_NAMESPACE_CXX11
3976#if _GLIBCXX_USE_C99_STDLIB
3979 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3980 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
3984 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3985 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
3988 inline unsigned long
3989 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3990 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
3994 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3995 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
3998 inline unsigned long long
3999 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4000 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
4005 stof(
const string& __str,
size_t* __idx = 0)
4006 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
4009 stod(
const string& __str,
size_t* __idx = 0)
4010 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
4013 stold(
const string& __str,
size_t* __idx = 0)
4014 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
4020 to_string(
int __val)
4021#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4025 const bool __neg = __val < 0;
4026 const unsigned __uval = __neg ? (unsigned)~__val + 1u : __val;
4027 const auto __len = __detail::__to_chars_len(__uval);
4028 string __str(__neg + __len,
'-');
4029 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4034 to_string(
unsigned __val)
4035#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4039 string __str(__detail::__to_chars_len(__val),
'\0');
4040 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4045 to_string(
long __val)
4046#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4050 const bool __neg = __val < 0;
4051 const unsigned long __uval = __neg ? (
unsigned long)~__val + 1ul : __val;
4052 const auto __len = __detail::__to_chars_len(__uval);
4053 string __str(__neg + __len,
'-');
4054 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4059 to_string(
unsigned long __val)
4060#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4064 string __str(__detail::__to_chars_len(__val),
'\0');
4065 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4070 to_string(
long long __val)
4072 const bool __neg = __val < 0;
4073 const unsigned long long __uval
4074 = __neg ? (
unsigned long long)~__val + 1ull : __val;
4075 const auto __len = __detail::__to_chars_len(__uval);
4076 string __str(__neg + __len,
'-');
4077 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4082 to_string(
unsigned long long __val)
4084 string __str(__detail::__to_chars_len(__val),
'\0');
4085 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4089#if _GLIBCXX_USE_C99_STDIO
4093 to_string(
float __val)
4096 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4097 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4102 to_string(
double __val)
4105 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4106 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4111 to_string(
long double __val)
4114 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4115 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4120#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
4122 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4123 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
4127 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4128 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
4131 inline unsigned long
4132 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4133 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
4137 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4138 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
4141 inline unsigned long long
4142 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4143 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
4148 stof(
const wstring& __str,
size_t* __idx = 0)
4149 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
4152 stod(
const wstring& __str,
size_t* __idx = 0)
4153 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
4156 stold(
const wstring& __str,
size_t* __idx = 0)
4157 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
4159#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
4162 to_wstring(
int __val)
4163 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
int),
4167 to_wstring(
unsigned __val)
4168 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4169 4 *
sizeof(
unsigned),
4173 to_wstring(
long __val)
4174 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
long),
4178 to_wstring(
unsigned long __val)
4179 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4180 4 *
sizeof(
unsigned long),
4184 to_wstring(
long long __val)
4185 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4186 4 *
sizeof(
long long),
4190 to_wstring(
unsigned long long __val)
4191 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4192 4 *
sizeof(
unsigned long long),
4196 to_wstring(
float __val)
4199 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4200 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4205 to_wstring(
double __val)
4208 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4209 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4214 to_wstring(
long double __val)
4217 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4218 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4224_GLIBCXX_END_NAMESPACE_CXX11
4225_GLIBCXX_END_NAMESPACE_VERSION
4230#if __cplusplus >= 201103L
4234namespace std _GLIBCXX_VISIBILITY(default)
4236_GLIBCXX_BEGIN_NAMESPACE_VERSION
4240#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
4244 :
public __hash_base<size_t, string>
4247 operator()(
const string& __s)
const noexcept
4248 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
4258 :
public __hash_base<size_t, wstring>
4261 operator()(
const wstring& __s)
const noexcept
4262 {
return std::_Hash_impl::hash(__s.
data(),
4263 __s.
length() *
sizeof(
wchar_t)); }
4271#ifdef _GLIBCXX_USE_CHAR8_T
4274 struct hash<u8string>
4275 :
public __hash_base<size_t, u8string>
4278 operator()(
const u8string& __s)
const noexcept
4279 {
return std::_Hash_impl::hash(__s.data(),
4280 __s.length() *
sizeof(
char8_t)); }
4291 :
public __hash_base<size_t, u16string>
4294 operator()(
const u16string& __s)
const noexcept
4295 {
return std::_Hash_impl::hash(__s.
data(),
4296 __s.
length() *
sizeof(
char16_t)); }
4306 :
public __hash_base<size_t, u32string>
4309 operator()(
const u32string& __s)
const noexcept
4310 {
return std::_Hash_impl::hash(__s.
data(),
4311 __s.
length() *
sizeof(
char32_t)); }
4318#if __cplusplus >= 201402L
4320#define __cpp_lib_string_udls 201304L
4322 inline namespace literals
4324 inline namespace string_literals
4326#pragma GCC diagnostic push
4327#pragma GCC diagnostic ignored "-Wliteral-suffix"
4329#if __cpp_lib_constexpr_string >= 201907L
4330# define _GLIBCXX_STRING_CONSTEXPR constexpr
4332# define _GLIBCXX_STRING_CONSTEXPR
4335 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4336 inline basic_string<char>
4337 operator""s(
const char* __str,
size_t __len)
4338 {
return basic_string<char>{__str, __len}; }
4340 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4341 inline basic_string<wchar_t>
4342 operator""s(
const wchar_t* __str,
size_t __len)
4343 {
return basic_string<wchar_t>{__str, __len}; }
4345#ifdef _GLIBCXX_USE_CHAR8_T
4346 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4347 inline basic_string<char8_t>
4348 operator""s(
const char8_t* __str,
size_t __len)
4349 {
return basic_string<char8_t>{__str, __len}; }
4352 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4353 inline basic_string<char16_t>
4354 operator""s(
const char16_t* __str,
size_t __len)
4355 {
return basic_string<char16_t>{__str, __len}; }
4357 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4358 inline basic_string<char32_t>
4359 operator""s(
const char32_t* __str,
size_t __len)
4360 {
return basic_string<char32_t>{__str, __len}; }
4362#undef _GLIBCXX_STRING_CONSTEXPR
4363#pragma GCC diagnostic pop
4367#if __cplusplus >= 201703L
4368 namespace __detail::__variant
4370 template<
typename>
struct _Never_valueless_alt;
4374 template<
typename _Tp,
typename _Traits,
typename _Alloc>
4375 struct _Never_valueless_alt<
std::basic_string<_Tp, _Traits, _Alloc>>
4377 is_nothrow_move_constructible<std::basic_string<_Tp, _Traits, _Alloc>>,
4378 is_nothrow_move_assignable<std::basic_string<_Tp, _Traits, _Alloc>>
4385_GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
constexpr iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
basic_string< wchar_t > wstring
A string of wchar_t.
ISO C++ entities toplevel namespace is std.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
char_type widen(char __c) const
Widens characters.
Template class basic_istream.
Template class basic_ostream.
Primary class template hash.
Basis for explicit traits specializations.
Managing sequences of characters and character-like objects.
const_reverse_iterator crbegin() const noexcept
void swap(basic_string &__s) noexcept(/*conditional */)
Swap contents with another string.
void push_back(_CharT __c)
Append a single character.
const_iterator cend() const noexcept
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
const _CharT * data() const noexcept
Return const pointer to contents.
basic_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
size_type find_last_not_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character not in string.
int compare(const basic_string &__str) const
Compare to a string.
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
reverse_iterator rbegin()
void pop_back()
Remove the last character.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
size_type find_last_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
basic_string & operator+=(const basic_string &__str)
Append a string to this string.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
void reserve()
Equivalent to shrink_to_fit().
const_reference at(size_type __n) const
Provides access to the data contained in the string.
basic_string & append(const basic_string &__str)
Append a string to this string.
const_reverse_iterator crend() const noexcept
basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
bool empty() const noexcept
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
static const size_type npos
Value returned by various member functions when they fail.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
const_iterator cbegin() const noexcept
~basic_string() noexcept
Destroy the string instance.
size_type capacity() const noexcept
basic_string() noexcept
Default constructor creates an empty string.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
Uniform interface to all pointer-like types.
Forward iterators support a superset of input iterator operations.
Uniform interface to C++98 and C++11 allocators.