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
53 namespace 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());
274 {
return _M_data() == _M_local_data(); }
279 _M_create(size_type&, size_type);
286 _M_destroy(_M_allocated_capacity);
291 _M_destroy(size_type __size)
throw()
292 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
294 #if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
297 template<
typename _InIterator>
299 _M_construct_aux(_InIterator __beg, _InIterator __end,
302 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
303 _M_construct(__beg, __end, _Tag());
308 template<
typename _Integer>
310 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
311 { _M_construct_aux_2(
static_cast<size_type
>(__beg), __end); }
314 _M_construct_aux_2(size_type __req, _CharT __c)
315 { _M_construct(__req, __c); }
319 template<
typename _InIterator>
322 _M_construct(_InIterator __beg, _InIterator __end,
327 template<
typename _FwdIterator>
330 _M_construct(_FwdIterator __beg, _FwdIterator __end,
335 _M_construct(size_type __req, _CharT __c);
340 {
return _M_dataplus; }
343 const allocator_type&
344 _M_get_allocator()
const
345 {
return _M_dataplus; }
348 __attribute__((__always_inline__))
351 _M_use_local_data() _GLIBCXX_NOEXCEPT
353 #if __cpp_lib_is_constant_evaluated
355 for (_CharT& __c : _M_local_buf)
358 return _M_local_data();
363 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
366 template<
typename _Tp,
bool _Requires =
367 !__are_same<_Tp, _CharT*>::__value
368 && !__are_same<_Tp, const _CharT*>::__value
369 && !__are_same<_Tp, iterator>::__value
370 && !__are_same<_Tp, const_iterator>::__value>
371 struct __enable_if_not_native_iterator
373 template<
typename _Tp>
374 struct __enable_if_not_native_iterator<_Tp, false> { };
379 _M_check(size_type __pos,
const char* __s)
const
381 if (__pos > this->
size())
382 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > "
383 "this->size() (which is %zu)"),
384 __s, __pos, this->
size());
390 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
393 __throw_length_error(__N(__s));
400 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
402 const bool __testoff = __off < this->
size() - __pos;
403 return __testoff ? __off : this->
size() - __pos;
408 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
410 return (less<const _CharT*>()(__s, _M_data())
411 || less<const _CharT*>()(_M_data() + this->
size(), __s));
418 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
421 traits_type::assign(*__d, *__s);
423 traits_type::copy(__d, __s, __n);
428 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
431 traits_type::assign(*__d, *__s);
433 traits_type::move(__d, __s, __n);
438 _S_assign(_CharT* __d, size_type __n, _CharT __c)
441 traits_type::assign(*__d, __c);
443 traits_type::assign(__d, __n, __c);
448 template<
class _Iterator>
451 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
453 for (; __k1 != __k2; ++__k1, (void)++__p)
454 traits_type::assign(*__p, *__k1);
459 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
460 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
464 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
466 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
470 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
471 { _S_copy(__p, __k1, __k2 - __k1); }
475 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
477 { _S_copy(__p, __k1, __k2 - __k1); }
481 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
483 const difference_type __d = difference_type(__n1 - __n2);
485 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
486 return __gnu_cxx::__numeric_traits<int>::__max;
487 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
488 return __gnu_cxx::__numeric_traits<int>::__min;
499 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
504 _M_erase(size_type __pos, size_type __n);
516 _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value)
517 : _M_dataplus(_M_local_data())
529 : _M_dataplus(_M_local_data(), __a)
541 : _M_dataplus(_M_local_data(),
542 _Alloc_traits::_S_select_on_copy(__str._M_get_allocator()))
544 _M_construct(__str._M_data(), __str._M_data() + __str.length(),
558 const _Alloc& __a = _Alloc())
559 : _M_dataplus(_M_local_data(), __a)
561 const _CharT* __start = __str._M_data()
562 + __str._M_check(__pos,
"basic_string::basic_string");
563 _M_construct(__start, __start + __str._M_limit(__pos,
npos),
576 : _M_dataplus(_M_local_data())
578 const _CharT* __start = __str._M_data()
579 + __str._M_check(__pos,
"basic_string::basic_string");
580 _M_construct(__start, __start + __str._M_limit(__pos, __n),
593 size_type __n,
const _Alloc& __a)
594 : _M_dataplus(_M_local_data(), __a)
596 const _CharT* __start
597 = __str._M_data() + __str._M_check(__pos,
"string::string");
598 _M_construct(__start, __start + __str._M_limit(__pos, __n),
613 const _Alloc& __a = _Alloc())
614 : _M_dataplus(_M_local_data(), __a)
617 if (__s == 0 && __n > 0)
618 std::__throw_logic_error(__N(
"basic_string: "
619 "construction from null is not valid"));
628 #if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
631 template<
typename = _RequireAllocator<_Alloc>>
634 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc())
635 : _M_dataplus(_M_local_data(), __a)
639 std::__throw_logic_error(__N(
"basic_string: "
640 "construction from null is not valid"));
641 const _CharT* __end = __s + traits_type::length(__s);
642 _M_construct(__s, __end, forward_iterator_tag());
651 #if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
654 template<
typename = _RequireAllocator<_Alloc>>
657 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc())
658 : _M_dataplus(_M_local_data(), __a)
659 { _M_construct(__n, __c); }
661 #if __cplusplus >= 201103L
671 : _M_dataplus(_M_local_data(),
std::move(__str._M_get_allocator()))
673 if (__str._M_is_local())
675 traits_type::copy(_M_local_buf, __str._M_local_buf,
680 _M_data(__str._M_data());
681 _M_capacity(__str._M_allocated_capacity);
687 _M_length(__str.length());
688 __str._M_data(__str._M_local_data());
689 __str._M_set_length(0);
698 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
699 : _M_dataplus(_M_local_data(), __a)
704 : _M_dataplus(_M_local_data(), __a)
709 noexcept(_Alloc_traits::_S_always_equal())
710 : _M_dataplus(_M_local_data(), __a)
712 if (__str._M_is_local())
714 traits_type::copy(_M_local_buf, __str._M_local_buf,
716 _M_length(__str.length());
717 __str._M_set_length(0);
719 else if (_Alloc_traits::_S_always_equal()
720 || __str.get_allocator() == __a)
722 _M_data(__str._M_data());
723 _M_length(__str.length());
724 _M_capacity(__str._M_allocated_capacity);
725 __str._M_data(__str._M_local_buf);
726 __str._M_set_length(0);
733 #if __cplusplus >= 202100L
744 #if __cplusplus >= 201103L
745 template<
typename _InputIterator,
746 typename = std::_RequireInputIter<_InputIterator>>
748 template<
typename _InputIterator>
751 basic_string(_InputIterator __beg, _InputIterator __end,
752 const _Alloc& __a = _Alloc())
753 : _M_dataplus(_M_local_data(), __a)
755 #if __cplusplus >= 201103L
758 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
759 _M_construct_aux(__beg, __end, _Integral());
763 #if __cplusplus >= 201703L
771 template<
typename _Tp,
772 typename = enable_if_t<is_convertible_v<const _Tp&, __sv_type>>>
774 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
775 const _Alloc& __a = _Alloc())
783 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
786 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
787 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
805 return this->
assign(__str);
815 {
return this->
assign(__s); }
832 #if __cplusplus >= 201103L
845 noexcept(_Alloc_traits::_S_nothrow_move())
847 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
848 && !_Alloc_traits::_S_always_equal()
849 && _M_get_allocator() != __str._M_get_allocator())
852 _M_destroy(_M_allocated_capacity);
853 _M_data(_M_local_data());
857 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
859 if (__str._M_is_local())
867 this->_S_copy(_M_data(), __str._M_data(), __str.size());
868 _M_set_length(__str.size());
871 else if (_Alloc_traits::_S_propagate_on_move_assign()
872 || _Alloc_traits::_S_always_equal()
873 || _M_get_allocator() == __str._M_get_allocator())
876 pointer __data =
nullptr;
877 size_type __capacity;
880 if (_Alloc_traits::_S_always_equal())
884 __capacity = _M_allocated_capacity;
887 _M_destroy(_M_allocated_capacity);
890 _M_data(__str._M_data());
891 _M_length(__str.length());
892 _M_capacity(__str._M_allocated_capacity);
895 __str._M_data(__data);
896 __str._M_capacity(__capacity);
899 __str._M_data(__str._M_local_buf);
915 this->
assign(__l.begin(), __l.size());
920 #if __cplusplus >= 201703L
925 template<
typename _Tp>
927 _If_sv<_Tp, basic_string&>
929 {
return this->
assign(__svt); }
936 operator __sv_type() const noexcept
937 {
return __sv_type(
data(),
size()); }
947 begin() _GLIBCXX_NOEXCEPT
948 {
return iterator(_M_data()); }
956 begin() const _GLIBCXX_NOEXCEPT
957 {
return const_iterator(_M_data()); }
965 end() _GLIBCXX_NOEXCEPT
966 {
return iterator(_M_data() + this->
size()); }
974 end() const _GLIBCXX_NOEXCEPT
975 {
return const_iterator(_M_data() + this->
size()); }
984 rbegin() _GLIBCXX_NOEXCEPT
985 {
return reverse_iterator(this->
end()); }
993 const_reverse_iterator
994 rbegin() const _GLIBCXX_NOEXCEPT
995 {
return const_reverse_iterator(this->
end()); }
1002 _GLIBCXX20_CONSTEXPR
1004 rend() _GLIBCXX_NOEXCEPT
1005 {
return reverse_iterator(this->
begin()); }
1012 _GLIBCXX20_CONSTEXPR
1013 const_reverse_iterator
1014 rend() const _GLIBCXX_NOEXCEPT
1015 {
return const_reverse_iterator(this->
begin()); }
1017 #if __cplusplus >= 201103L
1022 _GLIBCXX20_CONSTEXPR
1025 {
return const_iterator(this->_M_data()); }
1031 _GLIBCXX20_CONSTEXPR
1033 cend() const noexcept
1034 {
return const_iterator(this->_M_data() + this->
size()); }
1041 _GLIBCXX20_CONSTEXPR
1042 const_reverse_iterator
1044 {
return const_reverse_iterator(this->
end()); }
1051 _GLIBCXX20_CONSTEXPR
1052 const_reverse_iterator
1053 crend() const noexcept
1054 {
return const_reverse_iterator(this->
begin()); }
1061 _GLIBCXX20_CONSTEXPR
1063 size() const _GLIBCXX_NOEXCEPT
1064 {
return _M_string_length; }
1068 _GLIBCXX20_CONSTEXPR
1070 length() const _GLIBCXX_NOEXCEPT
1071 {
return _M_string_length; }
1074 _GLIBCXX20_CONSTEXPR
1077 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
1089 _GLIBCXX20_CONSTEXPR
1091 resize(size_type __n, _CharT __c);
1103 _GLIBCXX20_CONSTEXPR
1106 { this->
resize(__n, _CharT()); }
1108 #if __cplusplus >= 201103L
1109 #pragma GCC diagnostic push
1110 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1112 _GLIBCXX20_CONSTEXPR
1116 #pragma GCC diagnostic pop
1119 #if __cplusplus > 202002L
1120 #define __cpp_lib_string_resize_and_overwrite 202110L
1121 template<
typename _Operation>
1123 resize_and_overwrite(size_type __n, _Operation __op);
1130 _GLIBCXX20_CONSTEXPR
1134 return _M_is_local() ? size_type(_S_local_capacity)
1135 : _M_allocated_capacity;
1155 _GLIBCXX20_CONSTEXPR
1162 #if __cplusplus > 201703L
1163 [[deprecated(
"use shrink_to_fit() instead")]]
1165 _GLIBCXX20_CONSTEXPR
1172 _GLIBCXX20_CONSTEXPR
1174 clear() _GLIBCXX_NOEXCEPT
1175 { _M_set_length(0); }
1181 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1183 empty() const _GLIBCXX_NOEXCEPT
1184 {
return this->
size() == 0; }
1197 _GLIBCXX20_CONSTEXPR
1199 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
1201 __glibcxx_assert(__pos <=
size());
1202 return _M_data()[__pos];
1215 _GLIBCXX20_CONSTEXPR
1221 __glibcxx_assert(__pos <=
size());
1223 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1224 return _M_data()[__pos];
1237 _GLIBCXX20_CONSTEXPR
1239 at(size_type __n)
const
1241 if (__n >= this->
size())
1242 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1243 "(which is %zu) >= this->size() "
1246 return _M_data()[__n];
1259 _GLIBCXX20_CONSTEXPR
1264 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1265 "(which is %zu) >= this->size() "
1268 return _M_data()[__n];
1271 #if __cplusplus >= 201103L
1276 _GLIBCXX20_CONSTEXPR
1280 __glibcxx_assert(!
empty());
1288 _GLIBCXX20_CONSTEXPR
1290 front() const noexcept
1292 __glibcxx_assert(!
empty());
1300 _GLIBCXX20_CONSTEXPR
1304 __glibcxx_assert(!
empty());
1312 _GLIBCXX20_CONSTEXPR
1314 back() const noexcept
1316 __glibcxx_assert(!
empty());
1327 _GLIBCXX20_CONSTEXPR
1330 {
return this->
append(__str); }
1337 _GLIBCXX20_CONSTEXPR
1340 {
return this->
append(__s); }
1347 _GLIBCXX20_CONSTEXPR
1355 #if __cplusplus >= 201103L
1361 _GLIBCXX20_CONSTEXPR
1364 {
return this->
append(__l.begin(), __l.size()); }
1367 #if __cplusplus >= 201703L
1373 template<
typename _Tp>
1374 _GLIBCXX20_CONSTEXPR
1375 _If_sv<_Tp, basic_string&>
1377 {
return this->
append(__svt); }
1385 _GLIBCXX20_CONSTEXPR
1388 {
return this->
append(__str._M_data(), __str.size()); }
1403 _GLIBCXX20_CONSTEXPR
1406 {
return this->
append(__str._M_data()
1407 + __str._M_check(__pos,
"basic_string::append"),
1408 __str._M_limit(__pos, __n)); }
1416 _GLIBCXX20_CONSTEXPR
1418 append(
const _CharT* __s, size_type __n)
1420 __glibcxx_requires_string_len(__s, __n);
1421 _M_check_length(size_type(0), __n,
"basic_string::append");
1422 return _M_append(__s, __n);
1430 _GLIBCXX20_CONSTEXPR
1432 append(
const _CharT* __s)
1434 __glibcxx_requires_string(__s);
1435 const size_type __n = traits_type::length(__s);
1436 _M_check_length(size_type(0), __n,
"basic_string::append");
1437 return _M_append(__s, __n);
1448 _GLIBCXX20_CONSTEXPR
1450 append(size_type __n, _CharT __c)
1451 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1453 #if __cplusplus >= 201103L
1459 _GLIBCXX20_CONSTEXPR
1461 append(initializer_list<_CharT> __l)
1462 {
return this->
append(__l.begin(), __l.size()); }
1473 #if __cplusplus >= 201103L
1474 template<
class _InputIterator,
1475 typename = std::_RequireInputIter<_InputIterator>>
1476 _GLIBCXX20_CONSTEXPR
1478 template<
class _InputIterator>
1481 append(_InputIterator __first, _InputIterator __last)
1484 #if __cplusplus >= 201703L
1490 template<
typename _Tp>
1491 _GLIBCXX20_CONSTEXPR
1492 _If_sv<_Tp, basic_string&>
1495 __sv_type __sv = __svt;
1496 return this->
append(__sv.data(), __sv.size());
1506 template<
typename _Tp>
1507 _GLIBCXX20_CONSTEXPR
1508 _If_sv<_Tp, basic_string&>
1509 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1511 __sv_type __sv = __svt;
1512 return _M_append(__sv.data()
1513 + std::__sv_check(__sv.size(), __pos,
"basic_string::append"),
1514 std::__sv_limit(__sv.size(), __pos, __n));
1522 _GLIBCXX20_CONSTEXPR
1526 const size_type __size = this->
size();
1528 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1529 traits_type::assign(this->_M_data()[__size], __c);
1530 this->_M_set_length(__size + 1);
1538 _GLIBCXX20_CONSTEXPR
1542 #if __cplusplus >= 201103L
1543 if (_Alloc_traits::_S_propagate_on_copy_assign())
1545 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
1546 && _M_get_allocator() != __str._M_get_allocator())
1550 if (__str.size() <= _S_local_capacity)
1552 _M_destroy(_M_allocated_capacity);
1553 _M_data(_M_use_local_data());
1558 const auto __len = __str.size();
1559 auto __alloc = __str._M_get_allocator();
1561 auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
1562 _M_destroy(_M_allocated_capacity);
1565 _M_set_length(__len);
1568 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
1571 this->_M_assign(__str);
1575 #if __cplusplus >= 201103L
1584 _GLIBCXX20_CONSTEXPR
1587 noexcept(_Alloc_traits::_S_nothrow_move())
1608 _GLIBCXX20_CONSTEXPR
1611 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1612 + __str._M_check(__pos,
"basic_string::assign"),
1613 __str._M_limit(__pos, __n)); }
1625 _GLIBCXX20_CONSTEXPR
1627 assign(
const _CharT* __s, size_type __n)
1629 __glibcxx_requires_string_len(__s, __n);
1630 return _M_replace(size_type(0), this->
size(), __s, __n);
1642 _GLIBCXX20_CONSTEXPR
1644 assign(
const _CharT* __s)
1646 __glibcxx_requires_string(__s);
1647 return _M_replace(size_type(0), this->
size(), __s,
1648 traits_type::length(__s));
1660 _GLIBCXX20_CONSTEXPR
1662 assign(size_type __n, _CharT __c)
1663 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1673 #if __cplusplus >= 201103L
1674 template<
class _InputIterator,
1675 typename = std::_RequireInputIter<_InputIterator>>
1676 _GLIBCXX20_CONSTEXPR
1678 template<
class _InputIterator>
1681 assign(_InputIterator __first, _InputIterator __last)
1684 #if __cplusplus >= 201103L
1690 _GLIBCXX20_CONSTEXPR
1692 assign(initializer_list<_CharT> __l)
1693 {
return this->
assign(__l.begin(), __l.size()); }
1696 #if __cplusplus >= 201703L
1702 template<
typename _Tp>
1703 _GLIBCXX20_CONSTEXPR
1704 _If_sv<_Tp, basic_string&>
1707 __sv_type __sv = __svt;
1708 return this->
assign(__sv.data(), __sv.size());
1718 template<
typename _Tp>
1719 _GLIBCXX20_CONSTEXPR
1720 _If_sv<_Tp, basic_string&>
1721 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1723 __sv_type __sv = __svt;
1724 return _M_replace(size_type(0), this->
size(),
1726 + std::__sv_check(__sv.size(), __pos,
"basic_string::assign"),
1727 std::__sv_limit(__sv.size(), __pos, __n));
1731 #if __cplusplus >= 201103L
1747 _GLIBCXX20_CONSTEXPR
1749 insert(const_iterator __p, size_type __n, _CharT __c)
1751 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1752 const size_type __pos = __p -
begin();
1753 this->
replace(__p, __p, __n, __c);
1754 return iterator(this->_M_data() + __pos);
1771 insert(iterator __p, size_type __n, _CharT __c)
1772 { this->
replace(__p, __p, __n, __c); }
1775 #if __cplusplus >= 201103L
1790 template<
class _InputIterator,
1791 typename = std::_RequireInputIter<_InputIterator>>
1792 _GLIBCXX20_CONSTEXPR
1794 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1796 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1797 const size_type __pos = __p -
begin();
1798 this->
replace(__p, __p, __beg, __end);
1799 return iterator(this->_M_data() + __pos);
1814 template<
class _InputIterator>
1816 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1817 { this->
replace(__p, __p, __beg, __end); }
1820 #if __cplusplus >= 201103L
1827 _GLIBCXX20_CONSTEXPR
1829 insert(const_iterator __p, initializer_list<_CharT> __l)
1830 {
return this->
insert(__p, __l.begin(), __l.end()); }
1832 #ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
1835 insert(iterator __p, initializer_list<_CharT> __l)
1837 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1838 this->
insert(__p -
begin(), __l.begin(), __l.size());
1855 _GLIBCXX20_CONSTEXPR
1858 {
return this->
replace(__pos1, size_type(0),
1859 __str._M_data(), __str.size()); }
1879 _GLIBCXX20_CONSTEXPR
1882 size_type __pos2, size_type __n =
npos)
1883 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1884 + __str._M_check(__pos2,
"basic_string::insert"),
1885 __str._M_limit(__pos2, __n)); }
1903 _GLIBCXX20_CONSTEXPR
1905 insert(size_type __pos,
const _CharT* __s, size_type __n)
1906 {
return this->
replace(__pos, size_type(0), __s, __n); }
1923 _GLIBCXX20_CONSTEXPR
1925 insert(size_type __pos,
const _CharT* __s)
1927 __glibcxx_requires_string(__s);
1928 return this->
replace(__pos, size_type(0), __s,
1929 traits_type::length(__s));
1948 _GLIBCXX20_CONSTEXPR
1950 insert(size_type __pos, size_type __n, _CharT __c)
1951 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1952 size_type(0), __n, __c); }
1967 _GLIBCXX20_CONSTEXPR
1969 insert(__const_iterator __p, _CharT __c)
1971 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1972 const size_type __pos = __p -
begin();
1973 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1974 return iterator(_M_data() + __pos);
1977 #if __cplusplus >= 201703L
1984 template<
typename _Tp>
1985 _GLIBCXX20_CONSTEXPR
1986 _If_sv<_Tp, basic_string&>
1987 insert(size_type __pos,
const _Tp& __svt)
1989 __sv_type __sv = __svt;
1990 return this->
insert(__pos, __sv.data(), __sv.size());
2001 template<
typename _Tp>
2002 _GLIBCXX20_CONSTEXPR
2003 _If_sv<_Tp, basic_string&>
2004 insert(size_type __pos1,
const _Tp& __svt,
2005 size_type __pos2, size_type __n =
npos)
2007 __sv_type __sv = __svt;
2008 return this->
replace(__pos1, size_type(0),
2010 + std::__sv_check(__sv.size(), __pos2,
"basic_string::insert"),
2011 std::__sv_limit(__sv.size(), __pos2, __n));
2030 _GLIBCXX20_CONSTEXPR
2032 erase(size_type __pos = 0, size_type __n =
npos)
2034 _M_check(__pos,
"basic_string::erase");
2036 this->_M_set_length(__pos);
2038 this->_M_erase(__pos, _M_limit(__pos, __n));
2050 _GLIBCXX20_CONSTEXPR
2052 erase(__const_iterator __position)
2054 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
2055 && __position <
end());
2056 const size_type __pos = __position -
begin();
2057 this->_M_erase(__pos, size_type(1));
2058 return iterator(_M_data() + __pos);
2070 _GLIBCXX20_CONSTEXPR
2072 erase(__const_iterator __first, __const_iterator __last)
2074 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
2075 && __last <=
end());
2076 const size_type __pos = __first -
begin();
2077 if (__last ==
end())
2078 this->_M_set_length(__pos);
2080 this->_M_erase(__pos, __last - __first);
2081 return iterator(this->_M_data() + __pos);
2084 #if __cplusplus >= 201103L
2090 _GLIBCXX20_CONSTEXPR
2094 __glibcxx_assert(!
empty());
2095 _M_erase(
size() - 1, 1);
2116 _GLIBCXX20_CONSTEXPR
2119 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
2139 _GLIBCXX20_CONSTEXPR
2142 size_type __pos2, size_type __n2 =
npos)
2143 {
return this->
replace(__pos1, __n1, __str._M_data()
2144 + __str._M_check(__pos2,
"basic_string::replace"),
2145 __str._M_limit(__pos2, __n2)); }
2165 _GLIBCXX20_CONSTEXPR
2167 replace(size_type __pos, size_type __n1,
const _CharT* __s,
2170 __glibcxx_requires_string_len(__s, __n2);
2171 return _M_replace(_M_check(__pos,
"basic_string::replace"),
2172 _M_limit(__pos, __n1), __s, __n2);
2191 _GLIBCXX20_CONSTEXPR
2193 replace(size_type __pos, size_type __n1,
const _CharT* __s)
2195 __glibcxx_requires_string(__s);
2196 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
2216 _GLIBCXX20_CONSTEXPR
2218 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
2219 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
2220 _M_limit(__pos, __n1), __n2, __c); }
2235 _GLIBCXX20_CONSTEXPR
2237 replace(__const_iterator __i1, __const_iterator __i2,
2239 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
2256 _GLIBCXX20_CONSTEXPR
2258 replace(__const_iterator __i1, __const_iterator __i2,
2259 const _CharT* __s, size_type __n)
2261 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2263 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2279 _GLIBCXX20_CONSTEXPR
2281 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2283 __glibcxx_requires_string(__s);
2284 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2301 _GLIBCXX20_CONSTEXPR
2303 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2306 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2308 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2326 #if __cplusplus >= 201103L
2327 template<
class _InputIterator,
2328 typename = std::_RequireInputIter<_InputIterator>>
2329 _GLIBCXX20_CONSTEXPR
2331 replace(const_iterator __i1, const_iterator __i2,
2332 _InputIterator __k1, _InputIterator __k2)
2334 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2336 __glibcxx_requires_valid_range(__k1, __k2);
2337 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2338 std::__false_type());
2341 template<
class _InputIterator>
2342 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
2343 typename __enable_if_not_native_iterator<_InputIterator>::__type
2347 replace(iterator __i1, iterator __i2,
2348 _InputIterator __k1, _InputIterator __k2)
2350 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2352 __glibcxx_requires_valid_range(__k1, __k2);
2353 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2354 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2360 _GLIBCXX20_CONSTEXPR
2362 replace(__const_iterator __i1, __const_iterator __i2,
2363 _CharT* __k1, _CharT* __k2)
2365 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2367 __glibcxx_requires_valid_range(__k1, __k2);
2372 _GLIBCXX20_CONSTEXPR
2374 replace(__const_iterator __i1, __const_iterator __i2,
2375 const _CharT* __k1,
const _CharT* __k2)
2377 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2379 __glibcxx_requires_valid_range(__k1, __k2);
2384 _GLIBCXX20_CONSTEXPR
2386 replace(__const_iterator __i1, __const_iterator __i2,
2387 iterator __k1, iterator __k2)
2389 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2391 __glibcxx_requires_valid_range(__k1, __k2);
2393 __k1.base(), __k2 - __k1);
2396 _GLIBCXX20_CONSTEXPR
2398 replace(__const_iterator __i1, __const_iterator __i2,
2399 const_iterator __k1, const_iterator __k2)
2401 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2403 __glibcxx_requires_valid_range(__k1, __k2);
2405 __k1.base(), __k2 - __k1);
2408 #if __cplusplus >= 201103L
2423 _GLIBCXX20_CONSTEXPR
2425 initializer_list<_CharT> __l)
2426 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2429 #if __cplusplus >= 201703L
2437 template<
typename _Tp>
2438 _GLIBCXX20_CONSTEXPR
2439 _If_sv<_Tp, basic_string&>
2440 replace(size_type __pos, size_type __n,
const _Tp& __svt)
2442 __sv_type __sv = __svt;
2443 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2455 template<
typename _Tp>
2456 _GLIBCXX20_CONSTEXPR
2457 _If_sv<_Tp, basic_string&>
2458 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2459 size_type __pos2, size_type __n2 =
npos)
2461 __sv_type __sv = __svt;
2462 return this->
replace(__pos1, __n1,
2464 + std::__sv_check(__sv.size(), __pos2,
"basic_string::replace"),
2465 std::__sv_limit(__sv.size(), __pos2, __n2));
2477 template<
typename _Tp>
2478 _GLIBCXX20_CONSTEXPR
2479 _If_sv<_Tp, basic_string&>
2480 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2482 __sv_type __sv = __svt;
2483 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2488 template<
class _Integer>
2489 _GLIBCXX20_CONSTEXPR
2491 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2492 _Integer __n, _Integer __val, __true_type)
2493 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2495 template<
class _InputIterator>
2496 _GLIBCXX20_CONSTEXPR
2498 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2499 _InputIterator __k1, _InputIterator __k2,
2502 _GLIBCXX20_CONSTEXPR
2504 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2507 _GLIBCXX20_CONSTEXPR
2509 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2510 const size_type __len2);
2512 _GLIBCXX20_CONSTEXPR
2514 _M_append(
const _CharT* __s, size_type __n);
2530 _GLIBCXX20_CONSTEXPR
2532 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2541 _GLIBCXX20_CONSTEXPR
2552 _GLIBCXX20_CONSTEXPR
2554 c_str() const _GLIBCXX_NOEXCEPT
2555 {
return _M_data(); }
2565 _GLIBCXX20_CONSTEXPR
2567 data() const _GLIBCXX_NOEXCEPT
2568 {
return _M_data(); }
2570 #if __cplusplus >= 201703L
2577 _GLIBCXX20_CONSTEXPR
2580 {
return _M_data(); }
2586 _GLIBCXX20_CONSTEXPR
2589 {
return _M_get_allocator(); }
2603 _GLIBCXX20_CONSTEXPR
2605 find(
const _CharT* __s, size_type __pos, size_type __n)
const
2618 _GLIBCXX20_CONSTEXPR
2622 {
return this->
find(__str.data(), __pos, __str.size()); }
2624 #if __cplusplus >= 201703L
2631 template<
typename _Tp>
2632 _GLIBCXX20_CONSTEXPR
2633 _If_sv<_Tp, size_type>
2634 find(
const _Tp& __svt, size_type __pos = 0) const
2635 noexcept(is_same<_Tp, __sv_type>::value)
2637 __sv_type __sv = __svt;
2638 return this->
find(__sv.data(), __pos, __sv.size());
2652 _GLIBCXX20_CONSTEXPR
2654 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2656 __glibcxx_requires_string(__s);
2657 return this->
find(__s, __pos, traits_type::length(__s));
2670 _GLIBCXX20_CONSTEXPR
2672 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
2684 _GLIBCXX20_CONSTEXPR
2688 {
return this->
rfind(__str.data(), __pos, __str.size()); }
2690 #if __cplusplus >= 201703L
2697 template<
typename _Tp>
2698 _GLIBCXX20_CONSTEXPR
2699 _If_sv<_Tp, size_type>
2700 rfind(
const _Tp& __svt, size_type __pos =
npos)
const
2701 noexcept(is_same<_Tp, __sv_type>::value)
2703 __sv_type __sv = __svt;
2704 return this->
rfind(__sv.data(), __pos, __sv.size());
2720 _GLIBCXX20_CONSTEXPR
2722 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
2735 _GLIBCXX20_CONSTEXPR
2737 rfind(
const _CharT* __s, size_type __pos =
npos)
const
2739 __glibcxx_requires_string(__s);
2740 return this->
rfind(__s, __pos, traits_type::length(__s));
2753 _GLIBCXX20_CONSTEXPR
2755 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
2768 _GLIBCXX20_CONSTEXPR
2772 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2774 #if __cplusplus >= 201703L
2782 template<
typename _Tp>
2783 _GLIBCXX20_CONSTEXPR
2784 _If_sv<_Tp, size_type>
2786 noexcept(is_same<_Tp, __sv_type>::value)
2788 __sv_type __sv = __svt;
2789 return this->
find_first_of(__sv.data(), __pos, __sv.size());
2805 _GLIBCXX20_CONSTEXPR
2807 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2820 _GLIBCXX20_CONSTEXPR
2825 __glibcxx_requires_string(__s);
2826 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2841 _GLIBCXX20_CONSTEXPR
2843 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2844 {
return this->
find(__c, __pos); }
2857 _GLIBCXX20_CONSTEXPR
2861 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2863 #if __cplusplus >= 201703L
2871 template<
typename _Tp>
2872 _GLIBCXX20_CONSTEXPR
2873 _If_sv<_Tp, size_type>
2875 noexcept(is_same<_Tp, __sv_type>::value)
2877 __sv_type __sv = __svt;
2878 return this->
find_last_of(__sv.data(), __pos, __sv.size());
2894 _GLIBCXX20_CONSTEXPR
2896 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2909 _GLIBCXX20_CONSTEXPR
2914 __glibcxx_requires_string(__s);
2915 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2930 _GLIBCXX20_CONSTEXPR
2933 {
return this->
rfind(__c, __pos); }
2945 _GLIBCXX20_CONSTEXPR
2951 #if __cplusplus >= 201703L
2959 template<
typename _Tp>
2960 _If_sv<_Tp, size_type>
2961 _GLIBCXX20_CONSTEXPR
2963 noexcept(is_same<_Tp, __sv_type>::value)
2965 __sv_type __sv = __svt;
2982 _GLIBCXX20_CONSTEXPR
2985 size_type __n)
const _GLIBCXX_NOEXCEPT;
2997 _GLIBCXX20_CONSTEXPR
3002 __glibcxx_requires_string(__s);
3016 _GLIBCXX20_CONSTEXPR
3032 _GLIBCXX20_CONSTEXPR
3038 #if __cplusplus >= 201703L
3046 template<
typename _Tp>
3047 _GLIBCXX20_CONSTEXPR
3048 _If_sv<_Tp, size_type>
3050 noexcept(is_same<_Tp, __sv_type>::value)
3052 __sv_type __sv = __svt;
3069 _GLIBCXX20_CONSTEXPR
3072 size_type __n)
const _GLIBCXX_NOEXCEPT;
3084 _GLIBCXX20_CONSTEXPR
3089 __glibcxx_requires_string(__s);
3103 _GLIBCXX20_CONSTEXPR
3120 _GLIBCXX20_CONSTEXPR
3122 substr(size_type __pos = 0, size_type __n =
npos)
const
3124 _M_check(__pos,
"basic_string::substr"), __n); }
3140 _GLIBCXX20_CONSTEXPR
3144 const size_type __size = this->
size();
3145 const size_type __osize = __str.size();
3146 const size_type __len =
std::min(__size, __osize);
3148 int __r = traits_type::compare(_M_data(), __str.data(), __len);
3150 __r = _S_compare(__size, __osize);
3154 #if __cplusplus >= 201703L
3160 template<
typename _Tp>
3161 _GLIBCXX20_CONSTEXPR
3163 compare(
const _Tp& __svt)
const
3164 noexcept(is_same<_Tp, __sv_type>::value)
3166 __sv_type __sv = __svt;
3167 const size_type __size = this->
size();
3168 const size_type __osize = __sv.size();
3169 const size_type __len =
std::min(__size, __osize);
3171 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
3173 __r = _S_compare(__size, __osize);
3185 template<
typename _Tp>
3186 _GLIBCXX20_CONSTEXPR
3188 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const
3189 noexcept(is_same<_Tp, __sv_type>::value)
3191 __sv_type __sv = __svt;
3192 return __sv_type(*this).substr(__pos, __n).compare(__sv);
3205 template<
typename _Tp>
3206 _GLIBCXX20_CONSTEXPR
3208 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
3209 size_type __pos2, size_type __n2 =
npos)
const
3210 noexcept(is_same<_Tp, __sv_type>::value)
3212 __sv_type __sv = __svt;
3213 return __sv_type(*
this)
3214 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
3237 _GLIBCXX20_CONSTEXPR
3264 _GLIBCXX20_CONSTEXPR
3267 size_type __pos2, size_type __n2 =
npos)
const;
3283 _GLIBCXX20_CONSTEXPR
3285 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
3308 _GLIBCXX20_CONSTEXPR
3310 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
3336 _GLIBCXX20_CONSTEXPR
3338 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3339 size_type __n2)
const;
3341 #if __cplusplus >= 202002L
3343 starts_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3344 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3347 starts_with(_CharT __x)
const noexcept
3348 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3351 starts_with(
const _CharT* __x)
const noexcept
3352 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3355 ends_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3356 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3359 ends_with(_CharT __x)
const noexcept
3360 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3363 ends_with(
const _CharT* __x)
const noexcept
3364 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3367 #if __cplusplus > 202002L
3369 contains(basic_string_view<_CharT, _Traits> __x)
const noexcept
3370 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3373 contains(_CharT __x)
const noexcept
3374 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3377 contains(
const _CharT* __x)
const noexcept
3378 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3382 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3384 _GLIBCXX_END_NAMESPACE_CXX11
3385 _GLIBCXX_END_NAMESPACE_VERSION
3389 namespace std _GLIBCXX_VISIBILITY(default)
3391 _GLIBCXX_BEGIN_NAMESPACE_VERSION
3393 #if __cpp_deduction_guides >= 201606
3394 _GLIBCXX_BEGIN_NAMESPACE_CXX11
3395 template<
typename _InputIterator,
typename _CharT
3396 =
typename iterator_traits<_InputIterator>::value_type,
3397 typename _Allocator = allocator<_CharT>,
3398 typename = _RequireInputIter<_InputIterator>,
3399 typename = _RequireAllocator<_Allocator>>
3400 basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
3401 -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
3405 template<
typename _CharT,
typename _Traits,
3406 typename _Allocator = allocator<_CharT>,
3407 typename = _RequireAllocator<_Allocator>>
3408 basic_string(basic_string_view<_CharT, _Traits>,
const _Allocator& = _Allocator())
3409 -> basic_string<_CharT, _Traits, _Allocator>;
3411 template<
typename _CharT,
typename _Traits,
3412 typename _Allocator = allocator<_CharT>,
3413 typename = _RequireAllocator<_Allocator>>
3414 basic_string(basic_string_view<_CharT, _Traits>,
3415 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3416 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3417 const _Allocator& = _Allocator())
3418 -> basic_string<_CharT, _Traits, _Allocator>;
3419 _GLIBCXX_END_NAMESPACE_CXX11
3429 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3430 _GLIBCXX20_CONSTEXPR
3431 basic_string<_CharT, _Traits, _Alloc>
3436 __str.append(__rhs);
3446 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3447 _GLIBCXX20_CONSTEXPR
3448 basic_string<_CharT,_Traits,_Alloc>
3450 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3458 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3459 _GLIBCXX20_CONSTEXPR
3460 basic_string<_CharT,_Traits,_Alloc>
3461 operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3469 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3470 _GLIBCXX20_CONSTEXPR
3471 inline basic_string<_CharT, _Traits, _Alloc>
3473 const _CharT* __rhs)
3476 __str.append(__rhs);
3486 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3487 _GLIBCXX20_CONSTEXPR
3488 inline basic_string<_CharT, _Traits, _Alloc>
3492 typedef typename __string_type::size_type __size_type;
3493 __string_type __str(__lhs);
3494 __str.append(__size_type(1), __rhs);
3498 #if __cplusplus >= 201103L
3499 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3500 _GLIBCXX20_CONSTEXPR
3501 inline basic_string<_CharT, _Traits, _Alloc>
3502 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3503 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
3504 {
return std::move(__lhs.append(__rhs)); }
3506 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3507 _GLIBCXX20_CONSTEXPR
3508 inline basic_string<_CharT, _Traits, _Alloc>
3509 operator+(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3510 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3511 {
return std::move(__rhs.insert(0, __lhs)); }
3513 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3514 _GLIBCXX20_CONSTEXPR
3515 inline basic_string<_CharT, _Traits, _Alloc>
3516 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3517 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3519 #if _GLIBCXX_USE_CXX11_ABI
3520 using _Alloc_traits = allocator_traits<_Alloc>;
3521 bool __use_rhs =
false;
3522 if _GLIBCXX17_CONSTEXPR (
typename _Alloc_traits::is_always_equal{})
3524 else if (__lhs.get_allocator() == __rhs.get_allocator())
3529 const auto __size = __lhs.size() + __rhs.size();
3530 if (__size > __lhs.capacity() && __size <= __rhs.capacity())
3531 return std::move(__rhs.insert(0, __lhs));
3536 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3537 _GLIBCXX20_CONSTEXPR
3538 inline basic_string<_CharT, _Traits, _Alloc>
3540 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3541 {
return std::move(__rhs.insert(0, __lhs)); }
3543 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3544 _GLIBCXX20_CONSTEXPR
3545 inline basic_string<_CharT, _Traits, _Alloc>
3547 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3548 {
return std::move(__rhs.insert(0, 1, __lhs)); }
3550 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3551 _GLIBCXX20_CONSTEXPR
3552 inline basic_string<_CharT, _Traits, _Alloc>
3553 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3554 const _CharT* __rhs)
3555 {
return std::move(__lhs.append(__rhs)); }
3557 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3558 _GLIBCXX20_CONSTEXPR
3559 inline basic_string<_CharT, _Traits, _Alloc>
3560 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3562 {
return std::move(__lhs.append(1, __rhs)); }
3572 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3573 _GLIBCXX20_CONSTEXPR
3578 {
return __lhs.compare(__rhs) == 0; }
3580 template<
typename _CharT>
3581 _GLIBCXX20_CONSTEXPR
3583 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
3584 operator==(
const basic_string<_CharT>& __lhs,
3585 const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT
3586 {
return (__lhs.size() == __rhs.size()
3596 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3597 _GLIBCXX20_CONSTEXPR
3600 const _CharT* __rhs)
3601 {
return __lhs.compare(__rhs) == 0; }
3603 #if __cpp_lib_three_way_comparison
3611 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3613 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3614 const basic_string<_CharT, _Traits, _Alloc>& __rhs) noexcept
3615 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3616 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3625 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3627 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3628 const _CharT* __rhs) noexcept
3629 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3630 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3638 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3640 operator==(
const _CharT* __lhs,
3642 {
return __rhs.compare(__lhs) == 0; }
3651 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3656 {
return !(__lhs == __rhs); }
3664 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3666 operator!=(
const _CharT* __lhs,
3668 {
return !(__lhs == __rhs); }
3676 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3679 const _CharT* __rhs)
3680 {
return !(__lhs == __rhs); }
3689 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3694 {
return __lhs.compare(__rhs) < 0; }
3702 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3705 const _CharT* __rhs)
3706 {
return __lhs.compare(__rhs) < 0; }
3714 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3716 operator<(
const _CharT* __lhs,
3718 {
return __rhs.compare(__lhs) > 0; }
3727 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3732 {
return __lhs.compare(__rhs) > 0; }
3740 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3743 const _CharT* __rhs)
3744 {
return __lhs.compare(__rhs) > 0; }
3752 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3754 operator>(
const _CharT* __lhs,
3756 {
return __rhs.compare(__lhs) < 0; }
3765 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3770 {
return __lhs.compare(__rhs) <= 0; }
3778 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3781 const _CharT* __rhs)
3782 {
return __lhs.compare(__rhs) <= 0; }
3790 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3792 operator<=(
const _CharT* __lhs,
3794 {
return __rhs.compare(__lhs) >= 0; }
3803 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3808 {
return __lhs.compare(__rhs) >= 0; }
3816 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3819 const _CharT* __rhs)
3820 {
return __lhs.compare(__rhs) >= 0; }
3828 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3830 operator>=(
const _CharT* __lhs,
3832 {
return __rhs.compare(__lhs) <= 0; }
3842 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3843 _GLIBCXX20_CONSTEXPR
3847 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
3848 { __lhs.swap(__rhs); }
3863 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3864 basic_istream<_CharT, _Traits>&
3865 operator>>(basic_istream<_CharT, _Traits>& __is,
3866 basic_string<_CharT, _Traits, _Alloc>& __str);
3869 basic_istream<char>&
3881 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3888 return __ostream_insert(__os, __str.data(), __str.size());
3904 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3905 basic_istream<_CharT, _Traits>&
3906 getline(basic_istream<_CharT, _Traits>& __is,
3907 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
3921 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3922 inline basic_istream<_CharT, _Traits>&
3927 #if __cplusplus >= 201103L
3929 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3930 inline basic_istream<_CharT, _Traits>&
3936 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3937 inline basic_istream<_CharT, _Traits>&
3944 basic_istream<char>&
3945 getline(basic_istream<char>& __in, basic_string<char>& __str,
3948 #ifdef _GLIBCXX_USE_WCHAR_T
3950 basic_istream<wchar_t>&
3951 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
3955 _GLIBCXX_END_NAMESPACE_VERSION
3958 #if __cplusplus >= 201103L
3963 namespace std _GLIBCXX_VISIBILITY(default)
3965 _GLIBCXX_BEGIN_NAMESPACE_VERSION
3966 _GLIBCXX_BEGIN_NAMESPACE_CXX11
3968 #if _GLIBCXX_USE_C99_STDLIB
3971 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3972 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
3976 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3977 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
3980 inline unsigned long
3981 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3982 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
3986 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3987 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
3990 inline unsigned long long
3991 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3992 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
3997 stof(
const string& __str,
size_t* __idx = 0)
3998 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
4001 stod(
const string& __str,
size_t* __idx = 0)
4002 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
4005 stold(
const string& __str,
size_t* __idx = 0)
4006 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
4012 to_string(
int __val)
4013 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4017 const bool __neg = __val < 0;
4018 const unsigned __uval = __neg ? (unsigned)~__val + 1u : __val;
4019 const auto __len = __detail::__to_chars_len(__uval);
4020 string __str(__neg + __len,
'-');
4021 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4026 to_string(
unsigned __val)
4027 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4031 string __str(__detail::__to_chars_len(__val),
'\0');
4032 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4037 to_string(
long __val)
4038 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4042 const bool __neg = __val < 0;
4043 const unsigned long __uval = __neg ? (
unsigned long)~__val + 1ul : __val;
4044 const auto __len = __detail::__to_chars_len(__uval);
4045 string __str(__neg + __len,
'-');
4046 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4051 to_string(
unsigned long __val)
4052 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4056 string __str(__detail::__to_chars_len(__val),
'\0');
4057 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4062 to_string(
long long __val)
4064 const bool __neg = __val < 0;
4065 const unsigned long long __uval
4066 = __neg ? (
unsigned long long)~__val + 1ull : __val;
4067 const auto __len = __detail::__to_chars_len(__uval);
4068 string __str(__neg + __len,
'-');
4069 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4074 to_string(
unsigned long long __val)
4076 string __str(__detail::__to_chars_len(__val),
'\0');
4077 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4081 #if _GLIBCXX_USE_C99_STDIO
4085 to_string(
float __val)
4088 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4089 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4094 to_string(
double __val)
4097 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4098 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4103 to_string(
long double __val)
4106 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4107 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4112 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
4114 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4115 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
4119 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4120 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
4123 inline unsigned long
4124 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4125 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
4129 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4130 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
4133 inline unsigned long long
4134 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4135 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
4140 stof(
const wstring& __str,
size_t* __idx = 0)
4141 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
4144 stod(
const wstring& __str,
size_t* __idx = 0)
4145 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
4148 stold(
const wstring& __str,
size_t* __idx = 0)
4149 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
4151 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
4154 to_wstring(
int __val)
4155 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
int),
4159 to_wstring(
unsigned __val)
4160 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4161 4 *
sizeof(
unsigned),
4165 to_wstring(
long __val)
4166 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
long),
4170 to_wstring(
unsigned long __val)
4171 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4172 4 *
sizeof(
unsigned long),
4176 to_wstring(
long long __val)
4177 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4178 4 *
sizeof(
long long),
4182 to_wstring(
unsigned long long __val)
4183 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4184 4 *
sizeof(
unsigned long long),
4188 to_wstring(
float __val)
4191 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4192 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4197 to_wstring(
double __val)
4200 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4201 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4206 to_wstring(
long double __val)
4209 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4210 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4216 _GLIBCXX_END_NAMESPACE_CXX11
4217 _GLIBCXX_END_NAMESPACE_VERSION
4222 #if __cplusplus >= 201103L
4226 namespace std _GLIBCXX_VISIBILITY(default)
4228 _GLIBCXX_BEGIN_NAMESPACE_VERSION
4232 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X
4236 :
public __hash_base<size_t, string>
4239 operator()(
const string& __s)
const noexcept
4240 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
4250 :
public __hash_base<size_t, wstring>
4253 operator()(
const wstring& __s)
const noexcept
4254 {
return std::_Hash_impl::hash(__s.
data(),
4255 __s.
length() *
sizeof(
wchar_t)); }
4263 #ifdef _GLIBCXX_USE_CHAR8_T
4266 struct hash<u8string>
4267 :
public __hash_base<size_t, u8string>
4270 operator()(
const u8string& __s)
const noexcept
4271 {
return std::_Hash_impl::hash(__s.data(),
4272 __s.length() *
sizeof(char8_t)); }
4283 :
public __hash_base<size_t, u16string>
4286 operator()(
const u16string& __s)
const noexcept
4287 {
return std::_Hash_impl::hash(__s.
data(),
4288 __s.
length() *
sizeof(char16_t)); }
4298 :
public __hash_base<size_t, u32string>
4301 operator()(
const u32string& __s)
const noexcept
4302 {
return std::_Hash_impl::hash(__s.
data(),
4303 __s.
length() *
sizeof(char32_t)); }
4310 #if __cplusplus >= 201402L
4312 #define __cpp_lib_string_udls 201304L
4314 inline namespace literals
4316 inline namespace string_literals
4318 #pragma GCC diagnostic push
4319 #pragma GCC diagnostic ignored "-Wliteral-suffix"
4321 #if __cpp_lib_constexpr_string >= 201907L
4322 # define _GLIBCXX_STRING_CONSTEXPR constexpr
4324 # define _GLIBCXX_STRING_CONSTEXPR
4327 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4328 inline basic_string<char>
4329 operator""s(
const char* __str,
size_t __len)
4330 {
return basic_string<char>{__str, __len}; }
4332 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4333 inline basic_string<wchar_t>
4334 operator""s(
const wchar_t* __str,
size_t __len)
4335 {
return basic_string<wchar_t>{__str, __len}; }
4337 #ifdef _GLIBCXX_USE_CHAR8_T
4338 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4339 inline basic_string<char8_t>
4340 operator""s(
const char8_t* __str,
size_t __len)
4341 {
return basic_string<char8_t>{__str, __len}; }
4344 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4345 inline basic_string<char16_t>
4346 operator""s(
const char16_t* __str,
size_t __len)
4347 {
return basic_string<char16_t>{__str, __len}; }
4349 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4350 inline basic_string<char32_t>
4351 operator""s(
const char32_t* __str,
size_t __len)
4352 {
return basic_string<char32_t>{__str, __len}; }
4354 #undef _GLIBCXX_STRING_CONSTEXPR
4355 #pragma GCC diagnostic pop
4359 #if __cplusplus >= 201703L
4360 namespace __detail::__variant
4362 template<
typename>
struct _Never_valueless_alt;
4366 template<
typename _Tp,
typename _Traits,
typename _Alloc>
4367 struct _Never_valueless_alt<
std::basic_string<_Tp, _Traits, _Alloc>>
4369 is_nothrow_move_constructible<std::basic_string<_Tp, _Traits, _Alloc>>,
4370 is_nothrow_move_assignable<std::basic_string<_Tp, _Traits, _Alloc>>
4377 _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 _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
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 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.
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.
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.
constexpr _Iterator __base(_Iterator __it)
char_type widen(char __c) const
Widens characters.
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 * c_str() const noexcept
Return const pointer to null-terminated 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 & operator+=(const basic_string &__str)
Append a string to this string.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
reverse_iterator rbegin()
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
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.
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 _CharT * data() const noexcept
Return const pointer to contents.
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
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 & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
~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.
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.