34 #ifndef _BASIC_STRING_H
35 #define _BASIC_STRING_H 1
37 #pragma GCC system_header
43 #if __cplusplus >= 201103L
47 #if __cplusplus >= 201703L
51 #if ! _GLIBCXX_USE_CXX11_ABI
54 namespace std _GLIBCXX_VISIBILITY(default)
56 _GLIBCXX_BEGIN_NAMESPACE_VERSION
57 _GLIBCXX_BEGIN_NAMESPACE_CXX11
59 #ifdef __cpp_lib_is_constant_evaluated
61 # define __cpp_lib_constexpr_string 201907L
62 #elif __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
64 # define __cpp_lib_constexpr_string 201611L
85 template<
typename _CharT,
typename _Traits,
typename _Alloc>
89 rebind<_CharT>::other _Char_alloc_type;
91 #if __cpp_lib_constexpr_string < 201907L
94 template<
typename _Traits2,
typename _Dummy_for_PR85282>
99 [[__gnu__::__always_inline__]]
100 static constexpr
typename _Base::pointer
101 allocate(_Char_alloc_type& __a,
typename _Base::size_type __n)
103 pointer __p = _Base::allocate(__a, __n);
104 if (__builtin_is_constant_evaluated())
106 for (size_type __i = 0; __i < __n; ++__i)
107 std::construct_at(__builtin_addressof(__p[__i]));
112 template<
typename _Dummy_for_PR85282>
113 struct _Alloc_traits_impl<char_traits<_CharT>, _Dummy_for_PR85282>
119 using _Alloc_traits = _Alloc_traits_impl<_Traits, void>;
124 typedef _Traits traits_type;
125 typedef typename _Traits::char_type value_type;
126 typedef _Char_alloc_type allocator_type;
127 typedef typename _Alloc_traits::size_type size_type;
128 typedef typename _Alloc_traits::difference_type difference_type;
129 typedef typename _Alloc_traits::reference reference;
130 typedef typename _Alloc_traits::const_reference const_reference;
131 typedef typename _Alloc_traits::pointer pointer;
132 typedef typename _Alloc_traits::const_pointer const_pointer;
133 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
134 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
140 static const size_type
npos =
static_cast<size_type
>(-1);
144 #if __cplusplus < 201103L
145 typedef iterator __const_iterator;
147 typedef const_iterator __const_iterator;
151 #if __cplusplus >= 201703L
153 typedef basic_string_view<_CharT, _Traits> __sv_type;
155 template<
typename _Tp,
typename _Res>
157 __and_<is_convertible<const _Tp&, __sv_type>,
158 __not_<is_convertible<const _Tp*, const basic_string*>>,
159 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
165 _S_to_string_view(__sv_type __svt) noexcept
174 _GLIBCXX20_CONSTEXPR
explicit
175 __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
193 struct _Alloc_hider : allocator_type
195 #if __cplusplus < 201103L
196 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
197 : allocator_type(__a), _M_p(__dat) { }
200 _Alloc_hider(pointer __dat,
const _Alloc& __a)
201 : allocator_type(__a), _M_p(__dat) { }
204 _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc())
205 : allocator_type(
std::
move(__a)), _M_p(__dat) { }
211 _Alloc_hider _M_dataplus;
212 size_type _M_string_length;
214 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
218 _CharT _M_local_buf[_S_local_capacity + 1];
219 size_type _M_allocated_capacity;
225 { _M_dataplus._M_p = __p; }
229 _M_length(size_type __length)
230 { _M_string_length = __length; }
235 {
return _M_dataplus._M_p; }
241 #if __cplusplus >= 201103L
244 return pointer(_M_local_buf);
250 _M_local_data()
const
252 #if __cplusplus >= 201103L
255 return const_pointer(_M_local_buf);
261 _M_capacity(size_type __capacity)
262 { _M_allocated_capacity = __capacity; }
266 _M_set_length(size_type __n)
269 traits_type::assign(_M_data()[__n], _CharT());
275 {
return _M_data() == _M_local_data(); }
280 _M_create(size_type&, size_type);
287 _M_destroy(_M_allocated_capacity);
292 _M_destroy(size_type __size)
throw()
293 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
295 #if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
298 template<
typename _InIterator>
300 _M_construct_aux(_InIterator __beg, _InIterator __end,
303 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
304 _M_construct(__beg, __end, _Tag());
309 template<
typename _Integer>
311 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
312 { _M_construct_aux_2(
static_cast<size_type
>(__beg), __end); }
315 _M_construct_aux_2(size_type __req, _CharT __c)
316 { _M_construct(__req, __c); }
320 template<
typename _InIterator>
323 _M_construct(_InIterator __beg, _InIterator __end,
328 template<
typename _FwdIterator>
331 _M_construct(_FwdIterator __beg, _FwdIterator __end,
336 _M_construct(size_type __req, _CharT __c);
341 {
return _M_dataplus; }
344 const allocator_type&
345 _M_get_allocator()
const
346 {
return _M_dataplus; }
349 __attribute__((__always_inline__))
352 _M_use_local_data() _GLIBCXX_NOEXCEPT
354 #if __cpp_lib_is_constant_evaluated
355 if (__builtin_is_constant_evaluated())
356 _M_local_buf[0] = _CharT();
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);
742 #if __cplusplus >= 201103L
743 template<
typename _InputIterator,
744 typename = std::_RequireInputIter<_InputIterator>>
746 template<
typename _InputIterator>
749 basic_string(_InputIterator __beg, _InputIterator __end,
750 const _Alloc& __a = _Alloc())
751 : _M_dataplus(_M_local_data(), __a)
753 #if __cplusplus >= 201103L
756 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
757 _M_construct_aux(__beg, __end, _Integral());
761 #if __cplusplus >= 201703L
769 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
771 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
772 const _Alloc& __a = _Alloc())
780 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
783 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
784 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
802 return this->
assign(__str);
811 operator=(
const _CharT* __s)
812 {
return this->
assign(__s); }
823 operator=(_CharT __c)
829 #if __cplusplus >= 201103L
842 noexcept(_Alloc_traits::_S_nothrow_move())
844 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
845 && !_Alloc_traits::_S_always_equal()
846 && _M_get_allocator() != __str._M_get_allocator())
849 _M_destroy(_M_allocated_capacity);
850 _M_data(_M_local_data());
854 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
856 if (__str._M_is_local())
864 this->_S_copy(_M_data(), __str._M_data(), __str.size());
865 _M_set_length(__str.size());
868 else if (_Alloc_traits::_S_propagate_on_move_assign()
869 || _Alloc_traits::_S_always_equal()
870 || _M_get_allocator() == __str._M_get_allocator())
873 pointer __data =
nullptr;
874 size_type __capacity;
877 if (_Alloc_traits::_S_always_equal())
881 __capacity = _M_allocated_capacity;
884 _M_destroy(_M_allocated_capacity);
887 _M_data(__str._M_data());
888 _M_length(__str.length());
889 _M_capacity(__str._M_allocated_capacity);
892 __str._M_data(__data);
893 __str._M_capacity(__capacity);
896 __str._M_data(__str._M_local_buf);
910 operator=(initializer_list<_CharT> __l)
912 this->
assign(__l.begin(), __l.size());
917 #if __cplusplus >= 201703L
922 template<
typename _Tp>
924 _If_sv<_Tp, basic_string&>
925 operator=(
const _Tp& __svt)
926 {
return this->
assign(__svt); }
933 operator __sv_type() const noexcept
934 {
return __sv_type(
data(),
size()); }
944 begin() _GLIBCXX_NOEXCEPT
945 {
return iterator(_M_data()); }
953 begin() const _GLIBCXX_NOEXCEPT
954 {
return const_iterator(_M_data()); }
962 end() _GLIBCXX_NOEXCEPT
963 {
return iterator(_M_data() + this->
size()); }
971 end() const _GLIBCXX_NOEXCEPT
972 {
return const_iterator(_M_data() + this->
size()); }
981 rbegin() _GLIBCXX_NOEXCEPT
982 {
return reverse_iterator(this->
end()); }
990 const_reverse_iterator
991 rbegin() const _GLIBCXX_NOEXCEPT
992 {
return const_reverse_iterator(this->
end()); }
1001 rend() _GLIBCXX_NOEXCEPT
1002 {
return reverse_iterator(this->
begin()); }
1009 _GLIBCXX20_CONSTEXPR
1010 const_reverse_iterator
1011 rend() const _GLIBCXX_NOEXCEPT
1012 {
return const_reverse_iterator(this->
begin()); }
1014 #if __cplusplus >= 201103L
1019 _GLIBCXX20_CONSTEXPR
1022 {
return const_iterator(this->_M_data()); }
1028 _GLIBCXX20_CONSTEXPR
1030 cend() const noexcept
1031 {
return const_iterator(this->_M_data() + this->
size()); }
1038 _GLIBCXX20_CONSTEXPR
1039 const_reverse_iterator
1041 {
return const_reverse_iterator(this->
end()); }
1048 _GLIBCXX20_CONSTEXPR
1049 const_reverse_iterator
1050 crend() const noexcept
1051 {
return const_reverse_iterator(this->
begin()); }
1058 _GLIBCXX20_CONSTEXPR
1060 size() const _GLIBCXX_NOEXCEPT
1061 {
return _M_string_length; }
1065 _GLIBCXX20_CONSTEXPR
1067 length() const _GLIBCXX_NOEXCEPT
1068 {
return _M_string_length; }
1071 _GLIBCXX20_CONSTEXPR
1074 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
1086 _GLIBCXX20_CONSTEXPR
1088 resize(size_type __n, _CharT __c);
1100 _GLIBCXX20_CONSTEXPR
1103 { this->
resize(__n, _CharT()); }
1105 #if __cplusplus >= 201103L
1106 #pragma GCC diagnostic push
1107 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1109 _GLIBCXX20_CONSTEXPR
1113 #pragma GCC diagnostic pop
1116 #if __cplusplus > 202002L
1117 #define __cpp_lib_string_resize_and_overwrite 202110L
1118 template<
typename _Operation>
1120 resize_and_overwrite(size_type __n, _Operation __op);
1127 _GLIBCXX20_CONSTEXPR
1131 return _M_is_local() ? size_type(_S_local_capacity)
1132 : _M_allocated_capacity;
1152 _GLIBCXX20_CONSTEXPR
1159 #if __cplusplus > 201703L
1160 [[deprecated(
"use shrink_to_fit() instead")]]
1162 _GLIBCXX20_CONSTEXPR
1169 _GLIBCXX20_CONSTEXPR
1171 clear() _GLIBCXX_NOEXCEPT
1172 { _M_set_length(0); }
1178 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1180 empty() const _GLIBCXX_NOEXCEPT
1181 {
return this->
size() == 0; }
1194 _GLIBCXX20_CONSTEXPR
1196 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
1198 __glibcxx_assert(__pos <=
size());
1199 return _M_data()[__pos];
1212 _GLIBCXX20_CONSTEXPR
1218 __glibcxx_assert(__pos <=
size());
1220 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1221 return _M_data()[__pos];
1234 _GLIBCXX20_CONSTEXPR
1236 at(size_type __n)
const
1238 if (__n >= this->
size())
1239 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1240 "(which is %zu) >= this->size() "
1243 return _M_data()[__n];
1256 _GLIBCXX20_CONSTEXPR
1261 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1262 "(which is %zu) >= this->size() "
1265 return _M_data()[__n];
1268 #if __cplusplus >= 201103L
1273 _GLIBCXX20_CONSTEXPR
1277 __glibcxx_assert(!
empty());
1285 _GLIBCXX20_CONSTEXPR
1287 front() const noexcept
1289 __glibcxx_assert(!
empty());
1297 _GLIBCXX20_CONSTEXPR
1301 __glibcxx_assert(!
empty());
1309 _GLIBCXX20_CONSTEXPR
1311 back() const noexcept
1313 __glibcxx_assert(!
empty());
1324 _GLIBCXX20_CONSTEXPR
1327 {
return this->
append(__str); }
1334 _GLIBCXX20_CONSTEXPR
1337 {
return this->
append(__s); }
1344 _GLIBCXX20_CONSTEXPR
1352 #if __cplusplus >= 201103L
1358 _GLIBCXX20_CONSTEXPR
1361 {
return this->
append(__l.begin(), __l.size()); }
1364 #if __cplusplus >= 201703L
1370 template<
typename _Tp>
1371 _GLIBCXX20_CONSTEXPR
1372 _If_sv<_Tp, basic_string&>
1374 {
return this->
append(__svt); }
1382 _GLIBCXX20_CONSTEXPR
1385 {
return _M_append(__str._M_data(), __str.size()); }
1400 _GLIBCXX20_CONSTEXPR
1403 {
return _M_append(__str._M_data()
1404 + __str._M_check(__pos,
"basic_string::append"),
1405 __str._M_limit(__pos, __n)); }
1413 _GLIBCXX20_CONSTEXPR
1415 append(
const _CharT* __s, size_type __n)
1417 __glibcxx_requires_string_len(__s, __n);
1418 _M_check_length(size_type(0), __n,
"basic_string::append");
1419 return _M_append(__s, __n);
1427 _GLIBCXX20_CONSTEXPR
1429 append(
const _CharT* __s)
1431 __glibcxx_requires_string(__s);
1432 const size_type __n = traits_type::length(__s);
1433 _M_check_length(size_type(0), __n,
"basic_string::append");
1434 return _M_append(__s, __n);
1445 _GLIBCXX20_CONSTEXPR
1447 append(size_type __n, _CharT __c)
1448 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1450 #if __cplusplus >= 201103L
1456 _GLIBCXX20_CONSTEXPR
1458 append(initializer_list<_CharT> __l)
1459 {
return this->
append(__l.begin(), __l.size()); }
1470 #if __cplusplus >= 201103L
1471 template<
class _InputIterator,
1472 typename = std::_RequireInputIter<_InputIterator>>
1473 _GLIBCXX20_CONSTEXPR
1475 template<
class _InputIterator>
1478 append(_InputIterator __first, _InputIterator __last)
1481 #if __cplusplus >= 201703L
1487 template<
typename _Tp>
1488 _GLIBCXX20_CONSTEXPR
1489 _If_sv<_Tp, basic_string&>
1492 __sv_type __sv = __svt;
1493 return this->
append(__sv.data(), __sv.size());
1503 template<
typename _Tp>
1504 _GLIBCXX20_CONSTEXPR
1505 _If_sv<_Tp, basic_string&>
1506 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1508 __sv_type __sv = __svt;
1509 return _M_append(__sv.data()
1510 + std::__sv_check(__sv.size(), __pos,
"basic_string::append"),
1511 std::__sv_limit(__sv.size(), __pos, __n));
1519 _GLIBCXX20_CONSTEXPR
1523 const size_type __size = this->
size();
1525 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1526 traits_type::assign(this->_M_data()[__size], __c);
1527 this->_M_set_length(__size + 1);
1535 _GLIBCXX20_CONSTEXPR
1539 #if __cplusplus >= 201103L
1540 if (_Alloc_traits::_S_propagate_on_copy_assign())
1542 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
1543 && _M_get_allocator() != __str._M_get_allocator())
1547 if (__str.size() <= _S_local_capacity)
1549 _M_destroy(_M_allocated_capacity);
1550 _M_data(_M_use_local_data());
1555 const auto __len = __str.size();
1556 auto __alloc = __str._M_get_allocator();
1558 auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
1559 _M_destroy(_M_allocated_capacity);
1562 _M_set_length(__len);
1565 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
1568 this->_M_assign(__str);
1572 #if __cplusplus >= 201103L
1581 _GLIBCXX20_CONSTEXPR
1584 noexcept(_Alloc_traits::_S_nothrow_move())
1605 _GLIBCXX20_CONSTEXPR
1608 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1609 + __str._M_check(__pos,
"basic_string::assign"),
1610 __str._M_limit(__pos, __n)); }
1622 _GLIBCXX20_CONSTEXPR
1624 assign(
const _CharT* __s, size_type __n)
1626 __glibcxx_requires_string_len(__s, __n);
1627 return _M_replace(size_type(0), this->
size(), __s, __n);
1639 _GLIBCXX20_CONSTEXPR
1641 assign(
const _CharT* __s)
1643 __glibcxx_requires_string(__s);
1644 return _M_replace(size_type(0), this->
size(), __s,
1645 traits_type::length(__s));
1657 _GLIBCXX20_CONSTEXPR
1659 assign(size_type __n, _CharT __c)
1660 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1670 #if __cplusplus >= 201103L
1671 template<
class _InputIterator,
1672 typename = std::_RequireInputIter<_InputIterator>>
1673 _GLIBCXX20_CONSTEXPR
1675 template<
class _InputIterator>
1678 assign(_InputIterator __first, _InputIterator __last)
1681 #if __cplusplus >= 201103L
1687 _GLIBCXX20_CONSTEXPR
1689 assign(initializer_list<_CharT> __l)
1690 {
return this->
assign(__l.begin(), __l.size()); }
1693 #if __cplusplus >= 201703L
1699 template<
typename _Tp>
1700 _GLIBCXX20_CONSTEXPR
1701 _If_sv<_Tp, basic_string&>
1704 __sv_type __sv = __svt;
1705 return this->
assign(__sv.data(), __sv.size());
1715 template<
typename _Tp>
1716 _GLIBCXX20_CONSTEXPR
1717 _If_sv<_Tp, basic_string&>
1718 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1720 __sv_type __sv = __svt;
1721 return _M_replace(size_type(0), this->
size(),
1723 + std::__sv_check(__sv.size(), __pos,
"basic_string::assign"),
1724 std::__sv_limit(__sv.size(), __pos, __n));
1728 #if __cplusplus >= 201103L
1744 _GLIBCXX20_CONSTEXPR
1746 insert(const_iterator __p, size_type __n, _CharT __c)
1748 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1749 const size_type __pos = __p -
begin();
1750 this->
replace(__p, __p, __n, __c);
1751 return iterator(this->_M_data() + __pos);
1768 insert(iterator __p, size_type __n, _CharT __c)
1769 { this->
replace(__p, __p, __n, __c); }
1772 #if __cplusplus >= 201103L
1787 template<
class _InputIterator,
1788 typename = std::_RequireInputIter<_InputIterator>>
1789 _GLIBCXX20_CONSTEXPR
1791 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1793 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1794 const size_type __pos = __p -
begin();
1795 this->
replace(__p, __p, __beg, __end);
1796 return iterator(this->_M_data() + __pos);
1811 template<
class _InputIterator>
1813 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1814 { this->
replace(__p, __p, __beg, __end); }
1817 #if __cplusplus >= 201103L
1824 _GLIBCXX20_CONSTEXPR
1826 insert(const_iterator __p, initializer_list<_CharT> __l)
1827 {
return this->
insert(__p, __l.begin(), __l.end()); }
1829 #ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
1832 insert(iterator __p, initializer_list<_CharT> __l)
1834 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1835 this->
insert(__p -
begin(), __l.begin(), __l.size());
1852 _GLIBCXX20_CONSTEXPR
1855 {
return this->
replace(__pos1, size_type(0),
1856 __str._M_data(), __str.size()); }
1876 _GLIBCXX20_CONSTEXPR
1879 size_type __pos2, size_type __n =
npos)
1880 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1881 + __str._M_check(__pos2,
"basic_string::insert"),
1882 __str._M_limit(__pos2, __n)); }
1900 _GLIBCXX20_CONSTEXPR
1902 insert(size_type __pos,
const _CharT* __s, size_type __n)
1903 {
return this->
replace(__pos, size_type(0), __s, __n); }
1920 _GLIBCXX20_CONSTEXPR
1922 insert(size_type __pos,
const _CharT* __s)
1924 __glibcxx_requires_string(__s);
1925 return this->
replace(__pos, size_type(0), __s,
1926 traits_type::length(__s));
1945 _GLIBCXX20_CONSTEXPR
1947 insert(size_type __pos, size_type __n, _CharT __c)
1948 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1949 size_type(0), __n, __c); }
1964 _GLIBCXX20_CONSTEXPR
1966 insert(__const_iterator __p, _CharT __c)
1968 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1969 const size_type __pos = __p -
begin();
1970 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1971 return iterator(_M_data() + __pos);
1974 #if __cplusplus >= 201703L
1981 template<
typename _Tp>
1982 _GLIBCXX20_CONSTEXPR
1983 _If_sv<_Tp, basic_string&>
1984 insert(size_type __pos,
const _Tp& __svt)
1986 __sv_type __sv = __svt;
1987 return this->
insert(__pos, __sv.data(), __sv.size());
1998 template<
typename _Tp>
1999 _GLIBCXX20_CONSTEXPR
2000 _If_sv<_Tp, basic_string&>
2001 insert(size_type __pos1,
const _Tp& __svt,
2002 size_type __pos2, size_type __n =
npos)
2004 __sv_type __sv = __svt;
2005 return this->
replace(__pos1, size_type(0),
2007 + std::__sv_check(__sv.size(), __pos2,
"basic_string::insert"),
2008 std::__sv_limit(__sv.size(), __pos2, __n));
2027 _GLIBCXX20_CONSTEXPR
2029 erase(size_type __pos = 0, size_type __n =
npos)
2031 _M_check(__pos,
"basic_string::erase");
2033 this->_M_set_length(__pos);
2035 this->_M_erase(__pos, _M_limit(__pos, __n));
2047 _GLIBCXX20_CONSTEXPR
2049 erase(__const_iterator __position)
2051 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
2052 && __position <
end());
2053 const size_type __pos = __position -
begin();
2054 this->_M_erase(__pos, size_type(1));
2055 return iterator(_M_data() + __pos);
2067 _GLIBCXX20_CONSTEXPR
2069 erase(__const_iterator __first, __const_iterator __last)
2071 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
2072 && __last <=
end());
2073 const size_type __pos = __first -
begin();
2074 if (__last ==
end())
2075 this->_M_set_length(__pos);
2077 this->_M_erase(__pos, __last - __first);
2078 return iterator(this->_M_data() + __pos);
2081 #if __cplusplus >= 201103L
2087 _GLIBCXX20_CONSTEXPR
2091 __glibcxx_assert(!
empty());
2092 _M_erase(
size() - 1, 1);
2113 _GLIBCXX20_CONSTEXPR
2116 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
2136 _GLIBCXX20_CONSTEXPR
2139 size_type __pos2, size_type __n2 =
npos)
2140 {
return this->
replace(__pos1, __n1, __str._M_data()
2141 + __str._M_check(__pos2,
"basic_string::replace"),
2142 __str._M_limit(__pos2, __n2)); }
2162 _GLIBCXX20_CONSTEXPR
2164 replace(size_type __pos, size_type __n1,
const _CharT* __s,
2167 __glibcxx_requires_string_len(__s, __n2);
2168 return _M_replace(_M_check(__pos,
"basic_string::replace"),
2169 _M_limit(__pos, __n1), __s, __n2);
2188 _GLIBCXX20_CONSTEXPR
2190 replace(size_type __pos, size_type __n1,
const _CharT* __s)
2192 __glibcxx_requires_string(__s);
2193 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
2213 _GLIBCXX20_CONSTEXPR
2215 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
2216 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
2217 _M_limit(__pos, __n1), __n2, __c); }
2232 _GLIBCXX20_CONSTEXPR
2234 replace(__const_iterator __i1, __const_iterator __i2,
2236 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
2253 _GLIBCXX20_CONSTEXPR
2255 replace(__const_iterator __i1, __const_iterator __i2,
2256 const _CharT* __s, size_type __n)
2258 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2260 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2276 _GLIBCXX20_CONSTEXPR
2278 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2280 __glibcxx_requires_string(__s);
2281 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2298 _GLIBCXX20_CONSTEXPR
2300 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2303 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2305 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2323 #if __cplusplus >= 201103L
2324 template<
class _InputIterator,
2325 typename = std::_RequireInputIter<_InputIterator>>
2326 _GLIBCXX20_CONSTEXPR
2328 replace(const_iterator __i1, const_iterator __i2,
2329 _InputIterator __k1, _InputIterator __k2)
2331 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2333 __glibcxx_requires_valid_range(__k1, __k2);
2334 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2335 std::__false_type());
2338 template<
class _InputIterator>
2339 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
2340 typename __enable_if_not_native_iterator<_InputIterator>::__type
2344 replace(iterator __i1, iterator __i2,
2345 _InputIterator __k1, _InputIterator __k2)
2347 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2349 __glibcxx_requires_valid_range(__k1, __k2);
2350 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2351 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2357 _GLIBCXX20_CONSTEXPR
2359 replace(__const_iterator __i1, __const_iterator __i2,
2360 _CharT* __k1, _CharT* __k2)
2362 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2364 __glibcxx_requires_valid_range(__k1, __k2);
2369 _GLIBCXX20_CONSTEXPR
2371 replace(__const_iterator __i1, __const_iterator __i2,
2372 const _CharT* __k1,
const _CharT* __k2)
2374 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2376 __glibcxx_requires_valid_range(__k1, __k2);
2381 _GLIBCXX20_CONSTEXPR
2383 replace(__const_iterator __i1, __const_iterator __i2,
2384 iterator __k1, iterator __k2)
2386 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2388 __glibcxx_requires_valid_range(__k1, __k2);
2390 __k1.base(), __k2 - __k1);
2393 _GLIBCXX20_CONSTEXPR
2395 replace(__const_iterator __i1, __const_iterator __i2,
2396 const_iterator __k1, const_iterator __k2)
2398 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2400 __glibcxx_requires_valid_range(__k1, __k2);
2402 __k1.base(), __k2 - __k1);
2405 #if __cplusplus >= 201103L
2420 _GLIBCXX20_CONSTEXPR
2422 initializer_list<_CharT> __l)
2423 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2426 #if __cplusplus >= 201703L
2434 template<
typename _Tp>
2435 _GLIBCXX20_CONSTEXPR
2436 _If_sv<_Tp, basic_string&>
2437 replace(size_type __pos, size_type __n,
const _Tp& __svt)
2439 __sv_type __sv = __svt;
2440 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2452 template<
typename _Tp>
2453 _GLIBCXX20_CONSTEXPR
2454 _If_sv<_Tp, basic_string&>
2455 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2456 size_type __pos2, size_type __n2 =
npos)
2458 __sv_type __sv = __svt;
2459 return this->
replace(__pos1, __n1,
2461 + std::__sv_check(__sv.size(), __pos2,
"basic_string::replace"),
2462 std::__sv_limit(__sv.size(), __pos2, __n2));
2474 template<
typename _Tp>
2475 _GLIBCXX20_CONSTEXPR
2476 _If_sv<_Tp, basic_string&>
2477 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2479 __sv_type __sv = __svt;
2480 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2485 template<
class _Integer>
2486 _GLIBCXX20_CONSTEXPR
2488 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2489 _Integer __n, _Integer __val, __true_type)
2490 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2492 template<
class _InputIterator>
2493 _GLIBCXX20_CONSTEXPR
2495 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2496 _InputIterator __k1, _InputIterator __k2,
2499 _GLIBCXX20_CONSTEXPR
2501 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2504 _GLIBCXX20_CONSTEXPR
2506 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2507 const size_type __len2);
2509 _GLIBCXX20_CONSTEXPR
2511 _M_append(
const _CharT* __s, size_type __n);
2527 _GLIBCXX20_CONSTEXPR
2529 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2538 _GLIBCXX20_CONSTEXPR
2549 _GLIBCXX20_CONSTEXPR
2551 c_str() const _GLIBCXX_NOEXCEPT
2552 {
return _M_data(); }
2562 _GLIBCXX20_CONSTEXPR
2564 data() const _GLIBCXX_NOEXCEPT
2565 {
return _M_data(); }
2567 #if __cplusplus >= 201703L
2574 _GLIBCXX20_CONSTEXPR
2577 {
return _M_data(); }
2583 _GLIBCXX20_CONSTEXPR
2586 {
return _M_get_allocator(); }
2600 _GLIBCXX20_CONSTEXPR
2602 find(
const _CharT* __s, size_type __pos, size_type __n)
const
2615 _GLIBCXX20_CONSTEXPR
2619 {
return this->
find(__str.data(), __pos, __str.size()); }
2621 #if __cplusplus >= 201703L
2628 template<
typename _Tp>
2629 _GLIBCXX20_CONSTEXPR
2630 _If_sv<_Tp, size_type>
2631 find(
const _Tp& __svt, size_type __pos = 0) const
2632 noexcept(is_same<_Tp, __sv_type>::value)
2634 __sv_type __sv = __svt;
2635 return this->
find(__sv.data(), __pos, __sv.size());
2649 _GLIBCXX20_CONSTEXPR
2651 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2653 __glibcxx_requires_string(__s);
2654 return this->
find(__s, __pos, traits_type::length(__s));
2667 _GLIBCXX20_CONSTEXPR
2669 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
2681 _GLIBCXX20_CONSTEXPR
2685 {
return this->
rfind(__str.data(), __pos, __str.size()); }
2687 #if __cplusplus >= 201703L
2694 template<
typename _Tp>
2695 _GLIBCXX20_CONSTEXPR
2696 _If_sv<_Tp, size_type>
2697 rfind(
const _Tp& __svt, size_type __pos =
npos)
const
2698 noexcept(is_same<_Tp, __sv_type>::value)
2700 __sv_type __sv = __svt;
2701 return this->
rfind(__sv.data(), __pos, __sv.size());
2717 _GLIBCXX20_CONSTEXPR
2719 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
2732 _GLIBCXX20_CONSTEXPR
2734 rfind(
const _CharT* __s, size_type __pos =
npos)
const
2736 __glibcxx_requires_string(__s);
2737 return this->
rfind(__s, __pos, traits_type::length(__s));
2750 _GLIBCXX20_CONSTEXPR
2752 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
2765 _GLIBCXX20_CONSTEXPR
2769 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2771 #if __cplusplus >= 201703L
2779 template<
typename _Tp>
2780 _GLIBCXX20_CONSTEXPR
2781 _If_sv<_Tp, size_type>
2783 noexcept(is_same<_Tp, __sv_type>::value)
2785 __sv_type __sv = __svt;
2786 return this->
find_first_of(__sv.data(), __pos, __sv.size());
2802 _GLIBCXX20_CONSTEXPR
2804 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2817 _GLIBCXX20_CONSTEXPR
2822 __glibcxx_requires_string(__s);
2823 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2838 _GLIBCXX20_CONSTEXPR
2840 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2841 {
return this->
find(__c, __pos); }
2854 _GLIBCXX20_CONSTEXPR
2858 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2860 #if __cplusplus >= 201703L
2868 template<
typename _Tp>
2869 _GLIBCXX20_CONSTEXPR
2870 _If_sv<_Tp, size_type>
2872 noexcept(is_same<_Tp, __sv_type>::value)
2874 __sv_type __sv = __svt;
2875 return this->
find_last_of(__sv.data(), __pos, __sv.size());
2891 _GLIBCXX20_CONSTEXPR
2893 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
2906 _GLIBCXX20_CONSTEXPR
2911 __glibcxx_requires_string(__s);
2912 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2927 _GLIBCXX20_CONSTEXPR
2930 {
return this->
rfind(__c, __pos); }
2942 _GLIBCXX20_CONSTEXPR
2948 #if __cplusplus >= 201703L
2956 template<
typename _Tp>
2957 _If_sv<_Tp, size_type>
2958 _GLIBCXX20_CONSTEXPR
2960 noexcept(is_same<_Tp, __sv_type>::value)
2962 __sv_type __sv = __svt;
2979 _GLIBCXX20_CONSTEXPR
2982 size_type __n)
const _GLIBCXX_NOEXCEPT;
2994 _GLIBCXX20_CONSTEXPR
2999 __glibcxx_requires_string(__s);
3013 _GLIBCXX20_CONSTEXPR
3029 _GLIBCXX20_CONSTEXPR
3035 #if __cplusplus >= 201703L
3043 template<
typename _Tp>
3044 _GLIBCXX20_CONSTEXPR
3045 _If_sv<_Tp, size_type>
3047 noexcept(is_same<_Tp, __sv_type>::value)
3049 __sv_type __sv = __svt;
3066 _GLIBCXX20_CONSTEXPR
3069 size_type __n)
const _GLIBCXX_NOEXCEPT;
3081 _GLIBCXX20_CONSTEXPR
3086 __glibcxx_requires_string(__s);
3100 _GLIBCXX20_CONSTEXPR
3117 _GLIBCXX20_CONSTEXPR
3119 substr(size_type __pos = 0, size_type __n =
npos)
const
3121 _M_check(__pos,
"basic_string::substr"), __n); }
3137 _GLIBCXX20_CONSTEXPR
3141 const size_type __size = this->
size();
3142 const size_type __osize = __str.size();
3143 const size_type __len =
std::min(__size, __osize);
3145 int __r = traits_type::compare(_M_data(), __str.data(), __len);
3147 __r = _S_compare(__size, __osize);
3151 #if __cplusplus >= 201703L
3157 template<
typename _Tp>
3158 _GLIBCXX20_CONSTEXPR
3160 compare(
const _Tp& __svt)
const
3161 noexcept(is_same<_Tp, __sv_type>::value)
3163 __sv_type __sv = __svt;
3164 const size_type __size = this->
size();
3165 const size_type __osize = __sv.size();
3166 const size_type __len =
std::min(__size, __osize);
3168 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
3170 __r = _S_compare(__size, __osize);
3182 template<
typename _Tp>
3183 _GLIBCXX20_CONSTEXPR
3185 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const
3186 noexcept(is_same<_Tp, __sv_type>::value)
3188 __sv_type __sv = __svt;
3189 return __sv_type(*this).substr(__pos, __n).compare(__sv);
3202 template<
typename _Tp>
3203 _GLIBCXX20_CONSTEXPR
3205 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
3206 size_type __pos2, size_type __n2 =
npos)
const
3207 noexcept(is_same<_Tp, __sv_type>::value)
3209 __sv_type __sv = __svt;
3210 return __sv_type(*
this)
3211 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
3234 _GLIBCXX20_CONSTEXPR
3261 _GLIBCXX20_CONSTEXPR
3264 size_type __pos2, size_type __n2 =
npos)
const;
3280 _GLIBCXX20_CONSTEXPR
3282 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
3305 _GLIBCXX20_CONSTEXPR
3307 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
3333 _GLIBCXX20_CONSTEXPR
3335 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3336 size_type __n2)
const;
3338 #if __cplusplus >= 202002L
3340 starts_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3341 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3344 starts_with(_CharT __x)
const noexcept
3345 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3348 starts_with(
const _CharT* __x)
const noexcept
3349 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3352 ends_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3353 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3356 ends_with(_CharT __x)
const noexcept
3357 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3360 ends_with(
const _CharT* __x)
const noexcept
3361 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3364 #if __cplusplus > 202002L
3366 contains(basic_string_view<_CharT, _Traits> __x)
const noexcept
3367 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3370 contains(_CharT __x)
const noexcept
3371 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3374 contains(
const _CharT* __x)
const noexcept
3375 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3379 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3381 _GLIBCXX_END_NAMESPACE_CXX11
3382 _GLIBCXX_END_NAMESPACE_VERSION
3386 namespace std _GLIBCXX_VISIBILITY(default)
3388 _GLIBCXX_BEGIN_NAMESPACE_VERSION
3390 #if __cpp_deduction_guides >= 201606
3391 _GLIBCXX_BEGIN_NAMESPACE_CXX11
3392 template<
typename _InputIterator,
typename _CharT
3393 =
typename iterator_traits<_InputIterator>::value_type,
3394 typename _Allocator = allocator<_CharT>,
3395 typename = _RequireInputIter<_InputIterator>,
3396 typename = _RequireAllocator<_Allocator>>
3397 basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
3398 -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
3402 template<
typename _CharT,
typename _Traits,
3403 typename _Allocator = allocator<_CharT>,
3404 typename = _RequireAllocator<_Allocator>>
3405 basic_string(basic_string_view<_CharT, _Traits>,
const _Allocator& = _Allocator())
3406 -> basic_string<_CharT, _Traits, _Allocator>;
3408 template<
typename _CharT,
typename _Traits,
3409 typename _Allocator = allocator<_CharT>,
3410 typename = _RequireAllocator<_Allocator>>
3411 basic_string(basic_string_view<_CharT, _Traits>,
3412 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3413 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3414 const _Allocator& = _Allocator())
3415 -> basic_string<_CharT, _Traits, _Allocator>;
3416 _GLIBCXX_END_NAMESPACE_CXX11
3426 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3427 _GLIBCXX20_CONSTEXPR
3428 basic_string<_CharT, _Traits, _Alloc>
3433 __str.append(__rhs);
3443 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3444 _GLIBCXX20_CONSTEXPR
3445 basic_string<_CharT,_Traits,_Alloc>
3447 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3455 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3456 _GLIBCXX20_CONSTEXPR
3457 basic_string<_CharT,_Traits,_Alloc>
3458 operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
3466 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3467 _GLIBCXX20_CONSTEXPR
3468 inline basic_string<_CharT, _Traits, _Alloc>
3470 const _CharT* __rhs)
3473 __str.append(__rhs);
3483 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3484 _GLIBCXX20_CONSTEXPR
3485 inline basic_string<_CharT, _Traits, _Alloc>
3489 typedef typename __string_type::size_type __size_type;
3490 __string_type __str(__lhs);
3491 __str.append(__size_type(1), __rhs);
3495 #if __cplusplus >= 201103L
3496 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3497 _GLIBCXX20_CONSTEXPR
3498 inline basic_string<_CharT, _Traits, _Alloc>
3499 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3500 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
3501 {
return std::move(__lhs.append(__rhs)); }
3503 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3504 _GLIBCXX20_CONSTEXPR
3505 inline basic_string<_CharT, _Traits, _Alloc>
3506 operator+(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3507 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3508 {
return std::move(__rhs.insert(0, __lhs)); }
3510 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3511 _GLIBCXX20_CONSTEXPR
3512 inline basic_string<_CharT, _Traits, _Alloc>
3513 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3514 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3516 #if _GLIBCXX_USE_CXX11_ABI
3517 using _Alloc_traits = allocator_traits<_Alloc>;
3518 bool __use_rhs =
false;
3519 if _GLIBCXX17_CONSTEXPR (
typename _Alloc_traits::is_always_equal{})
3521 else if (__lhs.get_allocator() == __rhs.get_allocator())
3526 const auto __size = __lhs.size() + __rhs.size();
3527 if (__size > __lhs.capacity() && __size <= __rhs.capacity())
3528 return std::move(__rhs.insert(0, __lhs));
3533 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3534 _GLIBCXX20_CONSTEXPR
3535 inline basic_string<_CharT, _Traits, _Alloc>
3537 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3538 {
return std::move(__rhs.insert(0, __lhs)); }
3540 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3541 _GLIBCXX20_CONSTEXPR
3542 inline basic_string<_CharT, _Traits, _Alloc>
3544 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
3545 {
return std::move(__rhs.insert(0, 1, __lhs)); }
3547 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3548 _GLIBCXX20_CONSTEXPR
3549 inline basic_string<_CharT, _Traits, _Alloc>
3550 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3551 const _CharT* __rhs)
3552 {
return std::move(__lhs.append(__rhs)); }
3554 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3555 _GLIBCXX20_CONSTEXPR
3556 inline basic_string<_CharT, _Traits, _Alloc>
3557 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3559 {
return std::move(__lhs.append(1, __rhs)); }
3569 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3570 _GLIBCXX20_CONSTEXPR
3575 {
return __lhs.compare(__rhs) == 0; }
3577 template<
typename _CharT>
3578 _GLIBCXX20_CONSTEXPR
3580 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
3581 operator==(
const basic_string<_CharT>& __lhs,
3582 const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT
3583 {
return (__lhs.size() == __rhs.size()
3593 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3594 _GLIBCXX20_CONSTEXPR
3597 const _CharT* __rhs)
3598 {
return __lhs.compare(__rhs) == 0; }
3600 #if __cpp_lib_three_way_comparison
3608 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3610 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3611 const basic_string<_CharT, _Traits, _Alloc>& __rhs) noexcept
3612 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3613 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3622 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3624 operator<=>(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
3625 const _CharT* __rhs) noexcept
3626 -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
3627 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
3635 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3637 operator==(
const _CharT* __lhs,
3639 {
return __rhs.compare(__lhs) == 0; }
3648 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3653 {
return !(__lhs == __rhs); }
3661 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3663 operator!=(
const _CharT* __lhs,
3665 {
return !(__lhs == __rhs); }
3673 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3676 const _CharT* __rhs)
3677 {
return !(__lhs == __rhs); }
3686 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3691 {
return __lhs.compare(__rhs) < 0; }
3699 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3702 const _CharT* __rhs)
3703 {
return __lhs.compare(__rhs) < 0; }
3711 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3713 operator<(
const _CharT* __lhs,
3715 {
return __rhs.compare(__lhs) > 0; }
3724 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3729 {
return __lhs.compare(__rhs) > 0; }
3737 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3740 const _CharT* __rhs)
3741 {
return __lhs.compare(__rhs) > 0; }
3749 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3751 operator>(
const _CharT* __lhs,
3753 {
return __rhs.compare(__lhs) < 0; }
3762 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3767 {
return __lhs.compare(__rhs) <= 0; }
3775 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3778 const _CharT* __rhs)
3779 {
return __lhs.compare(__rhs) <= 0; }
3787 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3789 operator<=(
const _CharT* __lhs,
3791 {
return __rhs.compare(__lhs) >= 0; }
3800 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3805 {
return __lhs.compare(__rhs) >= 0; }
3813 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3816 const _CharT* __rhs)
3817 {
return __lhs.compare(__rhs) >= 0; }
3825 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3827 operator>=(
const _CharT* __lhs,
3829 {
return __rhs.compare(__lhs) <= 0; }
3839 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3840 _GLIBCXX20_CONSTEXPR
3844 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
3845 { __lhs.swap(__rhs); }
3860 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3861 basic_istream<_CharT, _Traits>&
3862 operator>>(basic_istream<_CharT, _Traits>& __is,
3863 basic_string<_CharT, _Traits, _Alloc>& __str);
3866 basic_istream<char>&
3878 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3885 return __ostream_insert(__os, __str.data(), __str.size());
3901 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3902 basic_istream<_CharT, _Traits>&
3903 getline(basic_istream<_CharT, _Traits>& __is,
3904 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
3918 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3919 inline basic_istream<_CharT, _Traits>&
3924 #if __cplusplus >= 201103L
3926 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3927 inline basic_istream<_CharT, _Traits>&
3933 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3934 inline basic_istream<_CharT, _Traits>&
3941 basic_istream<char>&
3942 getline(basic_istream<char>& __in, basic_string<char>& __str,
3945 #ifdef _GLIBCXX_USE_WCHAR_T
3947 basic_istream<wchar_t>&
3948 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
3952 _GLIBCXX_END_NAMESPACE_VERSION
3955 #if __cplusplus >= 201103L
3960 namespace std _GLIBCXX_VISIBILITY(default)
3962 _GLIBCXX_BEGIN_NAMESPACE_VERSION
3963 _GLIBCXX_BEGIN_NAMESPACE_CXX11
3965 #if _GLIBCXX_USE_C99_STDLIB
3968 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3969 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
3973 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3974 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
3977 inline unsigned long
3978 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3979 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
3983 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3984 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
3987 inline unsigned long long
3988 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
3989 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
3994 stof(
const string& __str,
size_t* __idx = 0)
3995 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
3998 stod(
const string& __str,
size_t* __idx = 0)
3999 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
4002 stold(
const string& __str,
size_t* __idx = 0)
4003 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
4009 to_string(
int __val)
4010 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4014 const bool __neg = __val < 0;
4015 const unsigned __uval = __neg ? (unsigned)~__val + 1u : __val;
4016 const auto __len = __detail::__to_chars_len(__uval);
4017 string __str(__neg + __len,
'-');
4018 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4023 to_string(
unsigned __val)
4024 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4028 string __str(__detail::__to_chars_len(__val),
'\0');
4029 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4034 to_string(
long __val)
4035 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4039 const bool __neg = __val < 0;
4040 const unsigned long __uval = __neg ? (
unsigned long)~__val + 1ul : __val;
4041 const auto __len = __detail::__to_chars_len(__uval);
4042 string __str(__neg + __len,
'-');
4043 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4048 to_string(
unsigned long __val)
4049 #if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4053 string __str(__detail::__to_chars_len(__val),
'\0');
4054 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4059 to_string(
long long __val)
4061 const bool __neg = __val < 0;
4062 const unsigned long long __uval
4063 = __neg ? (
unsigned long long)~__val + 1ull : __val;
4064 const auto __len = __detail::__to_chars_len(__uval);
4065 string __str(__neg + __len,
'-');
4066 __detail::__to_chars_10_impl(&__str[__neg], __len, __uval);
4071 to_string(
unsigned long long __val)
4073 string __str(__detail::__to_chars_len(__val),
'\0');
4074 __detail::__to_chars_10_impl(&__str[0], __str.size(), __val);
4078 #if _GLIBCXX_USE_C99_STDIO
4082 to_string(
float __val)
4085 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4086 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4091 to_string(
double __val)
4094 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4095 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4100 to_string(
long double __val)
4103 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4104 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4109 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
4111 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4112 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
4116 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4117 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
4120 inline unsigned long
4121 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4122 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
4126 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4127 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
4130 inline unsigned long long
4131 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4132 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
4137 stof(
const wstring& __str,
size_t* __idx = 0)
4138 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
4141 stod(
const wstring& __str,
size_t* __idx = 0)
4142 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
4145 stold(
const wstring& __str,
size_t* __idx = 0)
4146 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
4148 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
4151 to_wstring(
int __val)
4152 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
int),
4156 to_wstring(
unsigned __val)
4157 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4158 4 *
sizeof(
unsigned),
4162 to_wstring(
long __val)
4163 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
long),
4167 to_wstring(
unsigned long __val)
4168 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4169 4 *
sizeof(
unsigned long),
4173 to_wstring(
long long __val)
4174 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4175 4 *
sizeof(
long long),
4179 to_wstring(
unsigned long long __val)
4180 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
4181 4 *
sizeof(
unsigned long long),
4185 to_wstring(
float __val)
4188 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4189 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4194 to_wstring(
double __val)
4197 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4198 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4203 to_wstring(
long double __val)
4206 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4207 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
4213 _GLIBCXX_END_NAMESPACE_CXX11
4214 _GLIBCXX_END_NAMESPACE_VERSION
4219 #if __cplusplus >= 201103L
4223 namespace std _GLIBCXX_VISIBILITY(default)
4225 _GLIBCXX_BEGIN_NAMESPACE_VERSION
4229 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X
4233 :
public __hash_base<size_t, string>
4236 operator()(
const string& __s)
const noexcept
4237 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
4247 :
public __hash_base<size_t, wstring>
4250 operator()(
const wstring& __s)
const noexcept
4251 {
return std::_Hash_impl::hash(__s.
data(),
4252 __s.
length() *
sizeof(
wchar_t)); }
4260 #ifdef _GLIBCXX_USE_CHAR8_T
4263 struct hash<u8string>
4264 :
public __hash_base<size_t, u8string>
4267 operator()(
const u8string& __s)
const noexcept
4268 {
return std::_Hash_impl::hash(__s.data(),
4269 __s.length() *
sizeof(char8_t)); }
4280 :
public __hash_base<size_t, u16string>
4283 operator()(
const u16string& __s)
const noexcept
4284 {
return std::_Hash_impl::hash(__s.
data(),
4285 __s.
length() *
sizeof(char16_t)); }
4295 :
public __hash_base<size_t, u32string>
4298 operator()(
const u32string& __s)
const noexcept
4299 {
return std::_Hash_impl::hash(__s.
data(),
4300 __s.
length() *
sizeof(char32_t)); }
4307 #if __cplusplus >= 201402L
4309 #define __cpp_lib_string_udls 201304
4311 inline namespace literals
4313 inline namespace string_literals
4315 #pragma GCC diagnostic push
4316 #pragma GCC diagnostic ignored "-Wliteral-suffix"
4318 #if __cpp_lib_constexpr_string >= 201907L
4319 # define _GLIBCXX_STRING_CONSTEXPR constexpr
4321 # define _GLIBCXX_STRING_CONSTEXPR
4324 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4325 inline basic_string<char>
4326 operator""s(
const char* __str,
size_t __len)
4327 {
return basic_string<char>{__str, __len}; }
4329 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4330 inline basic_string<wchar_t>
4331 operator""s(
const wchar_t* __str,
size_t __len)
4332 {
return basic_string<wchar_t>{__str, __len}; }
4334 #ifdef _GLIBCXX_USE_CHAR8_T
4335 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4336 inline basic_string<char8_t>
4337 operator""s(
const char8_t* __str,
size_t __len)
4338 {
return basic_string<char8_t>{__str, __len}; }
4341 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4342 inline basic_string<char16_t>
4343 operator""s(
const char16_t* __str,
size_t __len)
4344 {
return basic_string<char16_t>{__str, __len}; }
4346 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4347 inline basic_string<char32_t>
4348 operator""s(
const char32_t* __str,
size_t __len)
4349 {
return basic_string<char32_t>{__str, __len}; }
4351 #undef _GLIBCXX_STRING_CONSTEXPR
4352 #pragma GCC diagnostic pop
4356 #if __cplusplus >= 201703L
4357 namespace __detail::__variant
4359 template<
typename>
struct _Never_valueless_alt;
4363 template<
typename _Tp,
typename _Traits,
typename _Alloc>
4364 struct _Never_valueless_alt<
std::basic_string<_Tp, _Traits, _Alloc>>
4366 is_nothrow_move_constructible<std::basic_string<_Tp, _Traits, _Alloc>>,
4367 is_nothrow_move_assignable<std::basic_string<_Tp, _Traits, _Alloc>>
4374 _GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
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
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.