34#ifndef _BASIC_STRING_H
35#define _BASIC_STRING_H 1
38#pragma GCC system_header
44#if __cplusplus >= 201103L
50#ifdef __glibcxx_string_view
54#if __glibcxx_containers_ranges
59#if __cplusplus > 202302L
64#if ! _GLIBCXX_USE_CXX11_ABI
68namespace std _GLIBCXX_VISIBILITY(default)
70_GLIBCXX_BEGIN_NAMESPACE_VERSION
71_GLIBCXX_BEGIN_NAMESPACE_CXX11
93 template<
typename _CharT,
typename _Traits,
typename _Alloc>
96#if __cplusplus >= 202002L
97 static_assert(is_trivially_copyable_v<_CharT>
98 && is_trivially_default_constructible_v<_CharT>
99 && is_standard_layout_v<_CharT>);
100 static_assert(is_same_v<_CharT, typename _Traits::char_type>);
101 static_assert(is_same_v<_CharT, typename _Alloc::value_type>);
102 using _Char_alloc_type = _Alloc;
105 rebind<_CharT>::other _Char_alloc_type;
112 typedef _Traits traits_type;
113 typedef typename _Traits::char_type value_type;
114 typedef _Char_alloc_type allocator_type;
115 typedef typename _Alloc_traits::size_type size_type;
116 typedef typename _Alloc_traits::difference_type difference_type;
117 typedef typename _Alloc_traits::reference reference;
118 typedef typename _Alloc_traits::const_reference const_reference;
119 typedef typename _Alloc_traits::pointer pointer;
120 typedef typename _Alloc_traits::const_pointer const_pointer;
121 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
122 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
128 static const size_type
npos =
static_cast<size_type
>(-1);
132#if __cplusplus < 201103L
133 typedef iterator __const_iterator;
135 typedef const_iterator __const_iterator;
139 static _GLIBCXX20_CONSTEXPR pointer
140 _S_allocate(_Char_alloc_type& __a, size_type __n)
143#if __glibcxx_constexpr_string >= 201907L
146 if constexpr (!is_same_v<_Traits, char_traits<_CharT>>)
147 if (std::__is_constant_evaluated())
149 for (size_type __i = 0; __i < __n; ++__i)
150 std::construct_at(__builtin_addressof(__p[__i]));
155#ifdef __glibcxx_string_view
159 template<
typename _Tp,
typename _Res>
161 __and_<is_convertible<const _Tp&, __sv_type>,
162 __not_<is_convertible<const _Tp*, const basic_string*>>,
163 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
169 _S_to_string_view(__sv_type __svt)
noexcept
178 _GLIBCXX20_CONSTEXPR
explicit
179 __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
197 struct _Alloc_hider : allocator_type
199#if __cplusplus < 201103L
200 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
201 : allocator_type(__a), _M_p(__dat) { }
204 _Alloc_hider(pointer __dat,
const _Alloc& __a)
205 : allocator_type(__a), _M_p(__dat) { }
208 _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc())
209 : allocator_type(std::
move(__a)), _M_p(__dat) { }
215 _Alloc_hider _M_dataplus;
216 size_type _M_string_length;
218 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
222 _CharT _M_local_buf[_S_local_capacity + 1];
223 size_type _M_allocated_capacity;
229 { _M_dataplus._M_p = __p; }
233 _M_length(size_type __length)
234 { _M_string_length = __length; }
239 {
return _M_dataplus._M_p; }
245#if __cplusplus >= 201103L
246 return std::pointer_traits<pointer>::pointer_to(*_M_local_buf);
248 return pointer(_M_local_buf);
254 _M_local_data()
const
256#if __cplusplus >= 201103L
257 return std::pointer_traits<const_pointer>::pointer_to(*_M_local_buf);
259 return const_pointer(_M_local_buf);
265 _M_capacity(size_type __capacity)
266 { _M_allocated_capacity = __capacity; }
270 _M_set_length(size_type __n)
273 traits_type::assign(_M_data()[__n], _CharT());
280 if (_M_data() == _M_local_data())
282 if (_M_string_length > _S_local_capacity)
283 __builtin_unreachable();
292 _M_create(size_type&, size_type);
299 _M_destroy(_M_allocated_capacity);
304 _M_destroy(size_type __size)
throw()
307#if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
310 template<
typename _InIterator>
312 _M_construct_aux(_InIterator __beg, _InIterator __end,
315 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
316 _M_construct(__beg, __end, _Tag());
321 template<
typename _Integer>
323 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
324 { _M_construct_aux_2(
static_cast<size_type
>(__beg), __end); }
327 _M_construct_aux_2(size_type __req, _CharT __c)
328 { _M_construct(__req, __c); }
332 template<
typename _InIterator>
335 _M_construct(_InIterator __beg, _InIterator __end,
340 template<
typename _FwdIterator>
343 _M_construct(_FwdIterator __beg, _FwdIterator __end,
348 _M_construct(size_type __req, _CharT __c);
352 template<
bool _Terminated>
355 _M_construct(
const _CharT *__c, size_type __n);
360 {
return _M_dataplus; }
363 const allocator_type&
364 _M_get_allocator()
const
365 {
return _M_dataplus; }
368 __attribute__((__always_inline__))
371 _M_init_local_buf() _GLIBCXX_NOEXCEPT
373#if __glibcxx_is_constant_evaluated
374 if (std::is_constant_evaluated())
375 for (size_type __i = 0; __i <= _S_local_capacity; ++__i)
376 _M_local_buf[__i] = _CharT();
380 __attribute__((__always_inline__))
383 _M_use_local_data() _GLIBCXX_NOEXCEPT
385#if __cpp_lib_is_constant_evaluated
388 return _M_local_data();
393#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
396 template<
typename _Tp,
bool _Requires =
397 !__are_same<_Tp, _CharT*>::__value
398 && !__are_same<_Tp, const _CharT*>::__value
399 && !__are_same<_Tp, iterator>::__value
400 && !__are_same<_Tp, const_iterator>::__value>
401 struct __enable_if_not_native_iterator
402 {
typedef basic_string& __type; };
403 template<
typename _Tp>
404 struct __enable_if_not_native_iterator<_Tp, false> { };
409 _M_check(size_type __pos,
const char* __s)
const
411 if (__pos > this->
size())
412 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > "
413 "this->size() (which is %zu)"),
414 __s, __pos, this->
size());
420 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
423 __throw_length_error(__N(__s));
430 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
432 const bool __testoff = __off < this->
size() - __pos;
433 return __testoff ? __off : this->
size() - __pos;
438 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
440 return (less<const _CharT*>()(__s, _M_data())
441 || less<const _CharT*>()(_M_data() + this->
size(), __s));
448 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
451 traits_type::assign(*__d, *__s);
453 traits_type::copy(__d, __s, __n);
458 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
461 traits_type::assign(*__d, *__s);
463 traits_type::move(__d, __s, __n);
468 _S_assign(_CharT* __d, size_type __n, _CharT __c)
471 traits_type::assign(*__d, __c);
473 traits_type::assign(__d, __n, __c);
476#pragma GCC diagnostic push
477#pragma GCC diagnostic ignored "-Wc++17-extensions"
480 template<
class _Iterator>
483 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
485#if __cplusplus >= 201103L
486 using _IterBase =
decltype(std::__niter_base(__k1));
487 if constexpr (__or_<is_same<_IterBase, _CharT*>,
488 is_same<_IterBase, const _CharT*>>::value)
489 _S_copy(__p, std::__niter_base(__k1), __k2 - __k1);
490#if __cpp_lib_concepts
491 else if constexpr (
requires {
492 requires contiguous_iterator<_Iterator>;
494 -> convertible_to<const _CharT*>;
497 const auto __d = __k2 - __k1;
504 for (; __k1 != __k2; ++__k1, (void)++__p)
505 traits_type::assign(*__p,
static_cast<_CharT
>(*__k1));
507#pragma GCC diagnostic pop
509#if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
511 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)
512 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
515 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
516 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
519 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
520 { _S_copy(__p, __k1, __k2 - __k1); }
523 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
524 { _S_copy(__p, __k1, __k2 - __k1); }
527#if __glibcxx_containers_ranges
529 template<
typename _Rg>
530 static constexpr void
531 _S_copy_range(pointer __p, _Rg&& __rg, size_type __n)
533 if constexpr (
requires {
534 requires ranges::contiguous_range<_Rg>;
536 -> convertible_to<const _CharT*>;
541 auto __first = ranges::begin(__rg);
542 const auto __last = ranges::end(__rg);
543 for (; __first != __last; ++__first)
544 traits_type::assign(*__p++,
static_cast<_CharT
>(*__first));
551 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
553 const difference_type __d = difference_type(__n1 - __n2);
555 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
556 return __gnu_cxx::__numeric_traits<int>::__max;
557 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
558 return __gnu_cxx::__numeric_traits<int>::__min;
569 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
574 _M_erase(size_type __pos, size_type __n);
587#if __cpp_concepts && __glibcxx_type_trait_variable_templates
588 requires is_default_constructible_v<_Alloc>
590 : _M_dataplus(_M_local_data())
602 : _M_dataplus(_M_local_data(), __a)
614 : _M_dataplus(_M_local_data(),
615 _Alloc_traits::_S_select_on_copy(__str._M_get_allocator()))
617 _M_construct<true>(__str._M_data(), __str.
length());
630 const _Alloc& __a = _Alloc())
631 : _M_dataplus(_M_local_data(), __a)
633 const _CharT* __start = __str._M_data()
634 + __str._M_check(__pos,
"basic_string::basic_string");
635 _M_construct(__start, __start + __str._M_limit(__pos,
npos),
648 : _M_dataplus(_M_local_data())
650 const _CharT* __start = __str._M_data()
651 + __str._M_check(__pos,
"basic_string::basic_string");
652 _M_construct(__start, __start + __str._M_limit(__pos, __n),
665 size_type __n,
const _Alloc& __a)
666 : _M_dataplus(_M_local_data(), __a)
668 const _CharT* __start
669 = __str._M_data() + __str._M_check(__pos,
"string::string");
670 _M_construct(__start, __start + __str._M_limit(__pos, __n),
685 const _Alloc& __a = _Alloc())
686 : _M_dataplus(_M_local_data(), __a)
689 if (__s == 0 && __n > 0)
690 std::__throw_logic_error(__N(
"basic_string: "
691 "construction from null is not valid"));
700#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
703 template<
typename = _RequireAllocator<_Alloc>>
707 : _M_dataplus(_M_local_data(), __a)
711 std::__throw_logic_error(__N(
"basic_string: "
712 "construction from null is not valid"));
713 const _CharT* __end = __s + traits_type::length(__s);
723#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
726 template<
typename = _RequireAllocator<_Alloc>>
730 : _M_dataplus(_M_local_data(), __a)
731 { _M_construct(__n, __c); }
733#if __cplusplus >= 201103L
743 : _M_dataplus(_M_local_data(),
std::move(__str._M_get_allocator()))
745 if (__str._M_is_local())
748 traits_type::copy(_M_local_buf, __str._M_local_buf,
753 _M_data(__str._M_data());
754 _M_capacity(__str._M_allocated_capacity);
760 _M_length(__str.
length());
761 __str._M_data(__str._M_use_local_data());
762 __str._M_set_length(0);
765#if __glibcxx_containers_ranges
770 template<__detail::__container_compatible_range<_CharT> _Rg>
772 basic_string(from_range_t, _Rg&& __rg,
const _Alloc& __a = _Alloc())
775 if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>)
777 const auto __n =
static_cast<size_type>(ranges::distance(__rg));
784 auto __first = ranges::begin(__rg);
785 const auto __last = ranges::end(__rg);
786 for (; __first != __last; ++__first)
799 : _M_dataplus(_M_local_data(), __a)
804 : _M_dataplus(_M_local_data(), __a)
809 noexcept(_Alloc_traits::_S_always_equal())
810 : _M_dataplus(_M_local_data(), __a)
812 if (__str._M_is_local())
815 traits_type::copy(_M_local_buf, __str._M_local_buf,
817 _M_length(__str.length());
818 __str._M_set_length(0);
820 else if (_Alloc_traits::_S_always_equal()
823 _M_data(__str._M_data());
824 _M_length(__str.length());
825 _M_capacity(__str._M_allocated_capacity);
826 __str._M_data(__str._M_use_local_data());
827 __str._M_set_length(0);
834#if __cplusplus >= 202100L
845#if __cplusplus >= 201103L
846 template<
typename _InputIterator,
847 typename = std::_RequireInputIter<_InputIterator>>
849 template<
typename _InputIterator>
853 const _Alloc& __a = _Alloc())
854 : _M_dataplus(_M_local_data(), __a), _M_string_length(0)
856#if __cplusplus >= 201103L
859 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
860 _M_construct_aux(__beg, __end, _Integral());
864#ifdef __glibcxx_string_view
872 template<
typename _Tp,
876 const _Alloc& __a = _Alloc())
884 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
887 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
888 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
916 {
return this->
assign(__s); }
933#if __cplusplus >= 201103L
946 noexcept(_Alloc_traits::_S_nothrow_move())
948 const bool __equal_allocs = _Alloc_traits::_S_always_equal()
949 || _M_get_allocator() == __str._M_get_allocator();
950 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
954 _M_destroy(_M_allocated_capacity);
955 _M_data(_M_local_data());
959 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
961 if (__str._M_is_local())
969 this->_S_copy(_M_data(), __str._M_data(), __str.
size());
970 _M_set_length(__str.
size());
973 else if (_Alloc_traits::_S_propagate_on_move_assign() || __equal_allocs)
976 pointer __data =
nullptr;
977 size_type __capacity;
984 __capacity = _M_allocated_capacity;
987 _M_destroy(_M_allocated_capacity);
990 _M_data(__str._M_data());
991 _M_length(__str.
length());
992 _M_capacity(__str._M_allocated_capacity);
995 __str._M_data(__data);
996 __str._M_capacity(__capacity);
999 __str._M_data(__str._M_use_local_data());
1011 _GLIBCXX20_CONSTEXPR
1015 this->
assign(__l.begin(), __l.size());
1020#ifdef __glibcxx_string_view
1025 template<
typename _Tp>
1026 _GLIBCXX20_CONSTEXPR
1027 _If_sv<_Tp, basic_string&>
1029 {
return this->
assign(__svt); }
1035 _GLIBCXX20_CONSTEXPR
1036 operator __sv_type() const noexcept
1037 {
return __sv_type(
data(),
size()); }
1045 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1048 {
return iterator(_M_data()); }
1054 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1057 {
return const_iterator(_M_data()); }
1063 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1066 {
return iterator(_M_data() + this->
size()); }
1072 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1075 {
return const_iterator(_M_data() + this->
size()); }
1082 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1085 {
return reverse_iterator(this->
end()); }
1092 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1093 const_reverse_iterator
1095 {
return const_reverse_iterator(this->
end()); }
1102 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1105 {
return reverse_iterator(this->
begin()); }
1112 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1113 const_reverse_iterator
1115 {
return const_reverse_iterator(this->
begin()); }
1117#if __cplusplus >= 201103L
1122 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1125 {
return const_iterator(this->_M_data()); }
1131 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1134 {
return const_iterator(this->_M_data() + this->
size()); }
1141 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1142 const_reverse_iterator
1144 {
return const_reverse_iterator(this->
end()); }
1151 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1152 const_reverse_iterator
1154 {
return const_reverse_iterator(this->
begin()); }
1161 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1165 size_type __sz = _M_string_length;
1167 __builtin_unreachable();
1173 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1179 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1183 const size_t __diffmax
1184 = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max /
sizeof(_CharT);
1186 return (
std::min)(__diffmax, __allocmax) - 1;
1199 _GLIBCXX20_CONSTEXPR
1213 _GLIBCXX20_CONSTEXPR
1216 { this->
resize(__n, _CharT()); }
1218#if __cplusplus >= 201103L
1219#pragma GCC diagnostic push
1220#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1222 _GLIBCXX20_CONSTEXPR
1226#pragma GCC diagnostic pop
1229#ifdef __glibcxx_string_resize_and_overwrite
1259 template<
typename _Operation>
1261 resize_and_overwrite(
size_type __n, _Operation __op);
1264#if __cplusplus >= 201103L
1266 template<
typename _Operation>
1267 _GLIBCXX20_CONSTEXPR
void
1275 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1279 size_t __sz = _M_is_local() ? size_type(_S_local_capacity)
1280 : _M_allocated_capacity;
1281 if (__sz < _S_local_capacity || __sz >
max_size ())
1282 __builtin_unreachable();
1303 _GLIBCXX20_CONSTEXPR
1310#if __cplusplus > 201703L
1311 [[deprecated(
"use shrink_to_fit() instead")]]
1313 _GLIBCXX20_CONSTEXPR
1320 _GLIBCXX20_CONSTEXPR
1323 { _M_set_length(0); }
1329 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1332 {
return _M_string_length == 0; }
1345 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1349 __glibcxx_assert(__pos <=
size());
1350 return _M_data()[__pos];
1363 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1369 __glibcxx_assert(__pos <=
size());
1371 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1372 return _M_data()[__pos];
1385 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1389 if (__n >= this->
size())
1390 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1391 "(which is %zu) >= this->size() "
1394 return _M_data()[__n];
1407 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1412 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
1413 "(which is %zu) >= this->size() "
1416 return _M_data()[__n];
1419#if __cplusplus >= 201103L
1424 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1428 __glibcxx_assert(!
empty());
1436 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1440 __glibcxx_assert(!
empty());
1448 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1452 __glibcxx_assert(!
empty());
1460 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
1464 __glibcxx_assert(!
empty());
1475 _GLIBCXX20_CONSTEXPR
1478 {
return this->
append(__str); }
1485 _GLIBCXX20_CONSTEXPR
1488 {
return this->
append(__s); }
1495 _GLIBCXX20_CONSTEXPR
1503#if __cplusplus >= 201103L
1509 _GLIBCXX20_CONSTEXPR
1512 {
return this->
append(__l.begin(), __l.size()); }
1515#ifdef __glibcxx_string_view
1521 template<
typename _Tp>
1522 _GLIBCXX20_CONSTEXPR
1523 _If_sv<_Tp, basic_string&>
1525 {
return this->
append(__svt); }
1533 _GLIBCXX20_CONSTEXPR
1536 {
return this->
append(__str._M_data(), __str.
size()); }
1551 _GLIBCXX20_CONSTEXPR
1554 {
return this->
append(__str._M_data()
1555 + __str._M_check(__pos,
"basic_string::append"),
1556 __str._M_limit(__pos, __n)); }
1564 _GLIBCXX20_CONSTEXPR
1568 __glibcxx_requires_string_len(__s, __n);
1569 _M_check_length(size_type(0), __n,
"basic_string::append");
1570 return _M_append(__s, __n);
1578 _GLIBCXX20_CONSTEXPR
1582 __glibcxx_requires_string(__s);
1583 const size_type __n = traits_type::length(__s);
1584 _M_check_length(size_type(0), __n,
"basic_string::append");
1585 return _M_append(__s, __n);
1596 _GLIBCXX20_CONSTEXPR
1599 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1601#if __glibcxx_containers_ranges
1609 template<__detail::__container_compatible_range<_CharT> _Rg>
1611 append_range(_Rg&& __rg)
1616 if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>)
1618 const auto __len =
size_type(ranges::distance(__rg));
1628 _M_check_length(0, __len,
"basic_string::append_range");
1630 __s.reserve(__newlen);
1633 _S_copy(__s._M_data(), _M_data(),
size());
1635 _M_destroy(_M_allocated_capacity);
1636 _M_data(__s._M_data());
1637 _M_capacity(__s._M_allocated_capacity);
1638 __s._M_data(__s._M_local_data());
1641 _M_set_length(__newlen);
1646 _M_get_allocator());
1653#if __cplusplus >= 201103L
1659 _GLIBCXX20_CONSTEXPR
1662 {
return this->
append(__l.begin(), __l.size()); }
1673#if __cplusplus >= 201103L
1674 template<
class _InputIterator,
1675 typename = std::_RequireInputIter<_InputIterator>>
1676 _GLIBCXX20_CONSTEXPR
1678 template<
class _InputIterator>
1681 append(_InputIterator __first, _InputIterator __last)
1684#ifdef __glibcxx_string_view
1690 template<
typename _Tp>
1691 _GLIBCXX20_CONSTEXPR
1692 _If_sv<_Tp, basic_string&>
1695 __sv_type __sv = __svt;
1696 return this->
append(__sv.data(), __sv.size());
1706 template<
typename _Tp>
1707 _GLIBCXX20_CONSTEXPR
1708 _If_sv<_Tp, basic_string&>
1709 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1711 __sv_type __sv = __svt;
1712 return _M_append(__sv.data()
1713 + std::__sv_check(__sv.size(), __pos,
"basic_string::append"),
1714 std::__sv_limit(__sv.size(), __pos, __n));
1722 _GLIBCXX20_CONSTEXPR
1726 const size_type __size = this->
size();
1728 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1729 traits_type::assign(this->_M_data()[__size], __c);
1730 this->_M_set_length(__size + 1);
1738 _GLIBCXX20_CONSTEXPR
1742#if __cplusplus >= 201103L
1743 if (_Alloc_traits::_S_propagate_on_copy_assign())
1745 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
1746 && _M_get_allocator() != __str._M_get_allocator())
1750 if (__str.
size() <= _S_local_capacity)
1752 _M_destroy(_M_allocated_capacity);
1753 _M_data(_M_use_local_data());
1758 const auto __len = __str.
size();
1759 auto __alloc = __str._M_get_allocator();
1761 auto __ptr = _S_allocate(__alloc, __len + 1);
1762 _M_destroy(_M_allocated_capacity);
1765 _M_set_length(__len);
1768 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
1771 this->_M_assign(__str);
1775#if __cplusplus >= 201103L
1784 _GLIBCXX20_CONSTEXPR
1787 noexcept(_Alloc_traits::_S_nothrow_move())
1808 _GLIBCXX20_CONSTEXPR
1811 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1812 + __str._M_check(__pos,
"basic_string::assign"),
1813 __str._M_limit(__pos, __n)); }
1825 _GLIBCXX20_CONSTEXPR
1829 __glibcxx_requires_string_len(__s, __n);
1830 return _M_replace(size_type(0), this->
size(), __s, __n);
1842 _GLIBCXX20_CONSTEXPR
1846 __glibcxx_requires_string(__s);
1847 return _M_replace(size_type(0), this->
size(), __s,
1848 traits_type::length(__s));
1860 _GLIBCXX20_CONSTEXPR
1863 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1873#if __cplusplus >= 201103L
1874#pragma GCC diagnostic push
1875#pragma GCC diagnostic ignored "-Wc++17-extensions"
1876 template<
class _InputIterator,
1877 typename = std::_RequireInputIter<_InputIterator>>
1878 _GLIBCXX20_CONSTEXPR
1880 assign(_InputIterator __first, _InputIterator __last)
1883 if constexpr (
is_pointer<
decltype(std::__niter_base(__first))>::value
1884 &&
is_same<
typename _IterTraits::value_type,
1887 __glibcxx_requires_valid_range(__first, __last);
1888 return _M_replace(size_type(0),
size(),
1889 std::__niter_base(__first), __last - __first);
1891#if __cplusplus >= 202002L
1892 else if constexpr (contiguous_iterator<_InputIterator>
1893 && is_same_v<iter_value_t<_InputIterator>,
1896 __glibcxx_requires_valid_range(__first, __last);
1897 return _M_replace(size_type(0),
size(),
1904#pragma GCC diagnostic pop
1906 template<
class _InputIterator>
1908 assign(_InputIterator __first, _InputIterator __last)
1912#if __glibcxx_containers_ranges
1920 template<__detail::__container_compatible_range<_CharT> _Rg>
1922 assign_range(_Rg&& __rg)
1925 _M_get_allocator());
1931#if __cplusplus >= 201103L
1937 _GLIBCXX20_CONSTEXPR
1943 const size_type __n = __l.size();
1949 _S_copy(_M_data(), __l.begin(), __n);
1956#ifdef __glibcxx_string_view
1962 template<
typename _Tp>
1963 _GLIBCXX20_CONSTEXPR
1964 _If_sv<_Tp, basic_string&>
1967 __sv_type __sv = __svt;
1968 return this->
assign(__sv.data(), __sv.size());
1978 template<
typename _Tp>
1979 _GLIBCXX20_CONSTEXPR
1980 _If_sv<_Tp, basic_string&>
1981 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1983 __sv_type __sv = __svt;
1984 return _M_replace(size_type(0), this->
size(),
1986 + std::__sv_check(__sv.size(), __pos,
"basic_string::assign"),
1987 std::__sv_limit(__sv.size(), __pos, __n));
1991#if __cplusplus >= 201103L
2007 _GLIBCXX20_CONSTEXPR
2009 insert(const_iterator __p, size_type __n, _CharT __c)
2011 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
2012 const size_type __pos = __p -
begin();
2013 this->
replace(__p, __p, __n, __c);
2014 return iterator(this->_M_data() + __pos);
2032 { this->
replace(__p, __p, __n, __c); }
2035#if __cplusplus >= 201103L
2050 template<
class _InputIterator,
2051 typename = std::_RequireInputIter<_InputIterator>>
2052 _GLIBCXX20_CONSTEXPR
2054 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
2056 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
2057 const size_type __pos = __p -
begin();
2058 this->
replace(__p, __p, __beg, __end);
2059 return iterator(this->_M_data() + __pos);
2074 template<
class _InputIterator>
2077 { this->
replace(__p, __p, __beg, __end); }
2080#if __glibcxx_containers_ranges
2088 template<__detail::__container_compatible_range<_CharT> _Rg>
2090 insert_range(const_iterator __p, _Rg&& __rg)
2092 auto __pos = __p -
cbegin();
2094 if constexpr (ranges::forward_range<_Rg>)
2095 if (ranges::empty(__rg))
2096 return begin() + __pos;
2104 _M_get_allocator());
2107 return begin() + __pos;
2111#if __cplusplus >= 201103L
2118 _GLIBCXX20_CONSTEXPR
2121 {
return this->
insert(__p, __l.begin(), __l.end()); }
2123#ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
2128 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
2129 this->
insert(__p -
begin(), __l.begin(), __l.size());
2146 _GLIBCXX20_CONSTEXPR
2149 {
return this->
replace(__pos1, size_type(0),
2150 __str._M_data(), __str.
size()); }
2170 _GLIBCXX20_CONSTEXPR
2173 size_type __pos2, size_type __n =
npos)
2174 {
return this->
replace(__pos1, size_type(0), __str._M_data()
2175 + __str._M_check(__pos2,
"basic_string::insert"),
2176 __str._M_limit(__pos2, __n)); }
2194 _GLIBCXX20_CONSTEXPR
2196 insert(size_type __pos,
const _CharT* __s, size_type __n)
2197 {
return this->
replace(__pos, size_type(0), __s, __n); }
2214 _GLIBCXX20_CONSTEXPR
2218 __glibcxx_requires_string(__s);
2219 return this->
replace(__pos, size_type(0), __s,
2220 traits_type::length(__s));
2239 _GLIBCXX20_CONSTEXPR
2241 insert(size_type __pos, size_type __n, _CharT __c)
2242 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
2243 size_type(0), __n, __c); }
2258 _GLIBCXX20_CONSTEXPR
2262 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
2263 const size_type __pos = __p -
begin();
2264 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
2265 return iterator(_M_data() + __pos);
2268#ifdef __glibcxx_string_view
2275 template<
typename _Tp>
2276 _GLIBCXX20_CONSTEXPR
2277 _If_sv<_Tp, basic_string&>
2280 __sv_type __sv = __svt;
2281 return this->
insert(__pos, __sv.data(), __sv.size());
2292 template<
typename _Tp>
2293 _GLIBCXX20_CONSTEXPR
2294 _If_sv<_Tp, basic_string&>
2295 insert(size_type __pos1,
const _Tp& __svt,
2296 size_type __pos2, size_type __n =
npos)
2298 __sv_type __sv = __svt;
2299 return this->
replace(__pos1, size_type(0),
2301 + std::__sv_check(__sv.size(), __pos2,
"basic_string::insert"),
2302 std::__sv_limit(__sv.size(), __pos2, __n));
2321 _GLIBCXX20_CONSTEXPR
2325 _M_check(__pos,
"basic_string::erase");
2327 this->_M_set_length(__pos);
2329 this->_M_erase(__pos, _M_limit(__pos, __n));
2341 _GLIBCXX20_CONSTEXPR
2345 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
2346 && __position <
end());
2347 const size_type __pos = __position -
begin();
2348 this->_M_erase(__pos, size_type(1));
2349 return iterator(_M_data() + __pos);
2361 _GLIBCXX20_CONSTEXPR
2363 erase(__const_iterator __first, __const_iterator __last)
2365 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
2366 && __last <=
end());
2367 const size_type __pos = __first -
begin();
2368 if (__last ==
end())
2369 this->_M_set_length(__pos);
2371 this->_M_erase(__pos, __last - __first);
2372 return iterator(this->_M_data() + __pos);
2375#if __cplusplus >= 201103L
2381 _GLIBCXX20_CONSTEXPR
2385 __glibcxx_assert(!
empty());
2386 _M_erase(
size() - 1, 1);
2407 _GLIBCXX20_CONSTEXPR
2410 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
2430 _GLIBCXX20_CONSTEXPR
2433 size_type __pos2, size_type __n2 =
npos)
2434 {
return this->
replace(__pos1, __n1, __str._M_data()
2435 + __str._M_check(__pos2,
"basic_string::replace"),
2436 __str._M_limit(__pos2, __n2)); }
2456 _GLIBCXX20_CONSTEXPR
2458 replace(size_type __pos, size_type __n1,
const _CharT* __s,
2461 __glibcxx_requires_string_len(__s, __n2);
2462 return _M_replace(_M_check(__pos,
"basic_string::replace"),
2463 _M_limit(__pos, __n1), __s, __n2);
2482 _GLIBCXX20_CONSTEXPR
2484 replace(size_type __pos, size_type __n1,
const _CharT* __s)
2486 __glibcxx_requires_string(__s);
2487 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
2507 _GLIBCXX20_CONSTEXPR
2509 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
2510 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
2511 _M_limit(__pos, __n1), __n2, __c); }
2526 _GLIBCXX20_CONSTEXPR
2528 replace(__const_iterator __i1, __const_iterator __i2,
2530 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
2547 _GLIBCXX20_CONSTEXPR
2549 replace(__const_iterator __i1, __const_iterator __i2,
2550 const _CharT* __s, size_type __n)
2552 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2554 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2570 _GLIBCXX20_CONSTEXPR
2572 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2574 __glibcxx_requires_string(__s);
2575 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2592 _GLIBCXX20_CONSTEXPR
2594 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2597 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2599 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2617#if __cplusplus >= 201103L
2618 template<
class _InputIterator,
2619 typename = std::_RequireInputIter<_InputIterator>>
2620 _GLIBCXX20_CONSTEXPR
2623 _InputIterator __k1, _InputIterator __k2)
2625 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2627 __glibcxx_requires_valid_range(__k1, __k2);
2628 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2629 std::__false_type());
2632 template<
class _InputIterator>
2633#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST
2634 typename __enable_if_not_native_iterator<_InputIterator>::__type
2639 _InputIterator __k1, _InputIterator __k2)
2641 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2643 __glibcxx_requires_valid_range(__k1, __k2);
2644 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2645 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2651 _GLIBCXX20_CONSTEXPR
2653 replace(__const_iterator __i1, __const_iterator __i2,
2654 _CharT* __k1, _CharT* __k2)
2656 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2658 __glibcxx_requires_valid_range(__k1, __k2);
2663 _GLIBCXX20_CONSTEXPR
2665 replace(__const_iterator __i1, __const_iterator __i2,
2666 const _CharT* __k1,
const _CharT* __k2)
2668 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2670 __glibcxx_requires_valid_range(__k1, __k2);
2675 _GLIBCXX20_CONSTEXPR
2677 replace(__const_iterator __i1, __const_iterator __i2,
2678 iterator __k1, iterator __k2)
2680 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2682 __glibcxx_requires_valid_range(__k1, __k2);
2684 __k1.base(), __k2 - __k1);
2687 _GLIBCXX20_CONSTEXPR
2689 replace(__const_iterator __i1, __const_iterator __i2,
2690 const_iterator __k1, const_iterator __k2)
2692 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2694 __glibcxx_requires_valid_range(__k1, __k2);
2696 __k1.base(), __k2 - __k1);
2699#if __glibcxx_containers_ranges
2707 template<__detail::__container_compatible_range<_CharT> _Rg>
2709 replace_with_range(const_iterator __i1, const_iterator __i2, _Rg&& __rg)
2716 _M_get_allocator());
2723#if __cplusplus >= 201103L
2738 _GLIBCXX20_CONSTEXPR
2741 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2744#ifdef __glibcxx_string_view
2752 template<
typename _Tp>
2753 _GLIBCXX20_CONSTEXPR
2754 _If_sv<_Tp, basic_string&>
2757 __sv_type __sv = __svt;
2758 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2770 template<
typename _Tp>
2771 _GLIBCXX20_CONSTEXPR
2772 _If_sv<_Tp, basic_string&>
2773 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2774 size_type __pos2, size_type __n2 =
npos)
2776 __sv_type __sv = __svt;
2777 return this->
replace(__pos1, __n1,
2779 + std::__sv_check(__sv.size(), __pos2,
"basic_string::replace"),
2780 std::__sv_limit(__sv.size(), __pos2, __n2));
2792 template<
typename _Tp>
2793 _GLIBCXX20_CONSTEXPR
2794 _If_sv<_Tp, basic_string&>
2795 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2797 __sv_type __sv = __svt;
2798 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2803 template<
class _Integer>
2804 _GLIBCXX20_CONSTEXPR
2806 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2807 _Integer __n, _Integer __val, __true_type)
2808 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2810 template<
class _InputIterator>
2811 _GLIBCXX20_CONSTEXPR
2813 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2814 _InputIterator __k1, _InputIterator __k2,
2817 _GLIBCXX20_CONSTEXPR
2819 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2822 __attribute__((__noinline__, __noclone__, __cold__))
void
2823 _M_replace_cold(pointer __p, size_type __len1,
const _CharT* __s,
2824 const size_type __len2,
const size_type __how_much);
2826 _GLIBCXX20_CONSTEXPR
2828 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2829 const size_type __len2);
2831 _GLIBCXX20_CONSTEXPR
2833 _M_append(
const _CharT* __s, size_type __n);
2849 _GLIBCXX20_CONSTEXPR
2851 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2860 _GLIBCXX20_CONSTEXPR
2871 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2874 {
return _M_data(); }
2884 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2887 {
return _M_data(); }
2889#if __cplusplus >= 201703L
2896 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2899 {
return _M_data(); }
2905 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2908 {
return _M_get_allocator(); }
2922 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2924 find(
const _CharT* __s, size_type __pos, size_type __n)
const
2937 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2941 {
return this->
find(__str.
data(), __pos, __str.
size()); }
2943#ifdef __glibcxx_string_view
2950 template<
typename _Tp>
2951 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2952 _If_sv<_Tp, size_type>
2954 noexcept(
is_same<_Tp, __sv_type>::value)
2956 __sv_type __sv = __svt;
2957 return this->
find(__sv.data(), __pos, __sv.size());
2971 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2973 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2975 __glibcxx_requires_string(__s);
2976 return this->
find(__s, __pos, traits_type::length(__s));
2989 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
2991 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
3003 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3007 {
return this->
rfind(__str.data(), __pos, __str.size()); }
3009#ifdef __glibcxx_string_view
3016 template<
typename _Tp>
3017 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3018 _If_sv<_Tp, size_type>
3022 __sv_type __sv = __svt;
3023 return this->
rfind(__sv.data(), __pos, __sv.size());
3039 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3041 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
3054 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3058 __glibcxx_requires_string(__s);
3059 return this->
rfind(__s, __pos, traits_type::length(__s));
3072 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3074 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
3087 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3093#ifdef __glibcxx_string_view
3101 template<
typename _Tp>
3102 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3103 _If_sv<_Tp, size_type>
3105 noexcept(
is_same<_Tp, __sv_type>::value)
3107 __sv_type __sv = __svt;
3108 return this->
find_first_of(__sv.data(), __pos, __sv.size());
3124 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3139 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3144 __glibcxx_requires_string(__s);
3145 return this->
find_first_of(__s, __pos, traits_type::length(__s));
3160 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3163 {
return this->
find(__c, __pos); }
3176 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3182#ifdef __glibcxx_string_view
3190 template<
typename _Tp>
3191 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3192 _If_sv<_Tp, size_type>
3196 __sv_type __sv = __svt;
3197 return this->
find_last_of(__sv.data(), __pos, __sv.size());
3213 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3228 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3233 __glibcxx_requires_string(__s);
3234 return this->
find_last_of(__s, __pos, traits_type::length(__s));
3249 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3252 {
return this->
rfind(__c, __pos); }
3264 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3270#ifdef __glibcxx_string_view
3278 template<
typename _Tp>
3279 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3280 _If_sv<_Tp, size_type>
3282 noexcept(
is_same<_Tp, __sv_type>::value)
3284 __sv_type __sv = __svt;
3301 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3304 size_type __n)
const _GLIBCXX_NOEXCEPT;
3316 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3321 __glibcxx_requires_string(__s);
3335 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3351 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3357#ifdef __glibcxx_string_view
3365 template<
typename _Tp>
3366 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3367 _If_sv<_Tp, size_type>
3371 __sv_type __sv = __svt;
3388 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3391 size_type __n)
const _GLIBCXX_NOEXCEPT;
3403 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3408 __glibcxx_requires_string(__s);
3422 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3439 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3443 _M_check(__pos,
"basic_string::substr"), __n); }
3459 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3463 const size_type __size = this->
size();
3464 const size_type __osize = __str.
size();
3465 const size_type __len =
std::min(__size, __osize);
3467 int __r = traits_type::compare(_M_data(), __str.
data(), __len);
3469 __r = _S_compare(__size, __osize);
3473#ifdef __glibcxx_string_view
3479 template<
typename _Tp>
3480 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3482 compare(
const _Tp& __svt)
const
3485 __sv_type __sv = __svt;
3487 const size_type __osize = __sv.size();
3490 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
3492 __r = _S_compare(__size, __osize);
3504 template<
typename _Tp>
3505 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3507 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const
3508 noexcept(is_same<_Tp, __sv_type>::value)
3510 __sv_type __sv = __svt;
3511 return __sv_type(*this).substr(__pos, __n).compare(__sv);
3524 template<
typename _Tp>
3525 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3527 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
3528 size_type __pos2, size_type __n2 =
npos)
const
3529 noexcept(is_same<_Tp, __sv_type>::value)
3531 __sv_type __sv = __svt;
3532 return __sv_type(*
this)
3533 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
3556 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3560 _M_check(__pos,
"basic_string::compare");
3561 __n = _M_limit(__pos, __n);
3562 const size_type __osize = __str.
size();
3563 const size_type __len =
std::min(__n, __osize);
3564 int __r = traits_type::compare(_M_data() + __pos, __str.
data(), __len);
3566 __r = _S_compare(__n, __osize);
3593 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3596 size_type __pos2, size_type __n2 =
npos)
const
3598 _M_check(__pos1,
"basic_string::compare");
3599 __str._M_check(__pos2,
"basic_string::compare");
3600 __n1 = _M_limit(__pos1, __n1);
3601 __n2 = __str._M_limit(__pos2, __n2);
3602 const size_type __len =
std::min(__n1, __n2);
3603 int __r = traits_type::compare(_M_data() + __pos1,
3604 __str.
data() + __pos2, __len);
3606 __r = _S_compare(__n1, __n2);
3624 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3626 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
3628 __glibcxx_requires_string(__s);
3629 const size_type __size = this->
size();
3630 const size_type __osize = traits_type::length(__s);
3631 const size_type __len =
std::min(__size, __osize);
3632 int __r = traits_type::compare(_M_data(), __s, __len);
3634 __r = _S_compare(__size, __osize);
3659 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3661 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const
3663 __glibcxx_requires_string(__s);
3664 _M_check(__pos,
"basic_string::compare");
3665 __n1 = _M_limit(__pos, __n1);
3666 const size_type __osize = traits_type::length(__s);
3667 const size_type __len =
std::min(__n1, __osize);
3668 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
3670 __r = _S_compare(__n1, __osize);
3698 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3700 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3701 size_type __n2)
const
3703 __glibcxx_requires_string_len(__s, __n2);
3704 _M_check(__pos,
"basic_string::compare");
3705 __n1 = _M_limit(__pos, __n1);
3706 const size_type __len =
std::min(__n1, __n2);
3707 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
3709 __r = _S_compare(__n1, __n2);
3713#if __cplusplus >= 202002L
3717 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3721 starts_with(_CharT __x)
const noexcept
3722 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3724 [[nodiscard, __gnu__::__nonnull__]]
3726 starts_with(
const _CharT* __x)
const noexcept
3727 {
return __sv_type(this->
data(), this->
size()).starts_with(__x); }
3731 ends_with(basic_string_view<_CharT, _Traits> __x)
const noexcept
3732 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3736 ends_with(_CharT __x)
const noexcept
3737 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3739 [[nodiscard, __gnu__::__nonnull__]]
3741 ends_with(
const _CharT* __x)
const noexcept
3742 {
return __sv_type(this->
data(), this->
size()).ends_with(__x); }
3745#if __cplusplus > 202002L
3748 contains(basic_string_view<_CharT, _Traits> __x)
const noexcept
3749 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3753 contains(_CharT __x)
const noexcept
3754 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3756 [[nodiscard, __gnu__::__nonnull__]]
3758 contains(
const _CharT* __x)
const noexcept
3759 {
return __sv_type(this->
data(), this->
size()).contains(__x); }
3763 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3765_GLIBCXX_END_NAMESPACE_CXX11
3766_GLIBCXX_END_NAMESPACE_VERSION
3770namespace std _GLIBCXX_VISIBILITY(default)
3772_GLIBCXX_BEGIN_NAMESPACE_VERSION
3774#if __cpp_deduction_guides >= 201606
3775_GLIBCXX_BEGIN_NAMESPACE_CXX11
3776 template<
typename _InputIterator,
typename _CharT
3779 typename = _RequireInputIter<_InputIterator>,
3780 typename = _RequireAllocator<_Allocator>>
3781 basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
3786 template<
typename _CharT,
typename _Traits,
3788 typename = _RequireAllocator<_Allocator>>
3792 template<
typename _CharT,
typename _Traits,
3794 typename = _RequireAllocator<_Allocator>>
3796 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3797 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
3798 const _Allocator& = _Allocator())
3801#if __glibcxx_containers_ranges
3802 template<ranges::input_range _Rg,
3804 basic_string(from_range_t, _Rg&&, _Allocator = _Allocator())
3809_GLIBCXX_END_NAMESPACE_CXX11
3812 template<
typename _Str>
3813 _GLIBCXX20_CONSTEXPR
3815 __str_concat(
typename _Str::value_type
const* __lhs,
3816 typename _Str::size_type __lhs_len,
3817 typename _Str::value_type
const* __rhs,
3818 typename _Str::size_type __rhs_len,
3819 typename _Str::allocator_type
const& __a)
3821 typedef typename _Str::allocator_type allocator_type;
3822 typedef __gnu_cxx::__alloc_traits<allocator_type> _Alloc_traits;
3823 _Str __str(_Alloc_traits::_S_select_on_copy(__a));
3824 __str.
reserve(__lhs_len + __rhs_len);
3825 __str.
append(__lhs, __lhs_len);
3826 __str.
append(__rhs, __rhs_len);
3837 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3838 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3844 return std::__str_concat<_Str>(__lhs.
c_str(), __lhs.
size(),
3855 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3856 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3857 inline basic_string<_CharT,_Traits,_Alloc>
3861 __glibcxx_requires_string(__lhs);
3863 return std::__str_concat<_Str>(__lhs, _Traits::length(__lhs),
3874 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3875 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3876 inline basic_string<_CharT,_Traits,_Alloc>
3880 return std::__str_concat<_Str>(__builtin_addressof(__lhs), 1,
3891 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3892 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3893 inline basic_string<_CharT, _Traits, _Alloc>
3895 const _CharT* __rhs)
3897 __glibcxx_requires_string(__rhs);
3899 return std::__str_concat<_Str>(__lhs.
c_str(), __lhs.
size(),
3900 __rhs, _Traits::length(__rhs),
3909 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3910 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3911 inline basic_string<_CharT, _Traits, _Alloc>
3915 return std::__str_concat<_Str>(__lhs.
c_str(), __lhs.
size(),
3916 __builtin_addressof(__rhs), 1,
3920#if __cplusplus >= 201103L
3921 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3922 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3923 inline basic_string<_CharT, _Traits, _Alloc>
3924 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
3925 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
3926 {
return std::move(__lhs.append(__rhs)); }
3928 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3929 _GLIBCXX20_CONSTEXPR
3933 {
return std::move(__rhs.insert(0, __lhs)); }
3935 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3936 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3941#pragma GCC diagnostic push
3942#pragma GCC diagnostic ignored "-Wc++17-extensions"
3945 bool __use_rhs =
false;
3948 else if (__lhs.get_allocator() == __rhs.get_allocator())
3952 const auto __size = __lhs.size() + __rhs.size();
3953 if (__size > __lhs.capacity() && __size <= __rhs.capacity())
3954 return std::move(__rhs.insert(0, __lhs));
3957#pragma GCC diagnostic pop
3960 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3961 _GLIBCXX_NODISCARD _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3965 {
return std::move(__rhs.insert(0, __lhs)); }
3967 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3968 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3972 {
return std::move(__rhs.insert(0, 1, __lhs)); }
3974 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3975 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3978 const _CharT* __rhs)
3979 {
return std::move(__lhs.append(__rhs)); }
3981 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3982 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
3986 {
return std::move(__lhs.append(1, __rhs)); }
3989#if __glibcxx_string_view >= 202403L
3991 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3998 return std::__str_concat<_Str>(__lhs.data(), __lhs.size(),
3999 __rhs.data(), __rhs.size(),
4000 __lhs.get_allocator());
4004 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4014 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4021 return std::__str_concat<_Str>(__lhs.data(), __lhs.size(),
4022 __rhs.data(), __rhs.size(),
4023 __rhs.get_allocator());
4027 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4033 return std::move(__rhs.insert(0, __lhs));
4044 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4045 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
4051 return __lhs.size() == __rhs.size()
4052 && !_Traits::compare(__lhs.data(), __rhs.data(), __lhs.size());
4061 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4062 _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
4065 const _CharT* __rhs)
4067 return __lhs.
size() == _Traits::length(__rhs)
4068 && !_Traits::compare(__lhs.
data(), __rhs, __lhs.
size());
4071#if __cpp_lib_three_way_comparison
4079 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4084 ->
decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
4085 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
4094 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4098 const _CharT* __rhs)
noexcept
4099 ->
decltype(__detail::__char_traits_cmp_cat<_Traits>(0))
4100 {
return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); }
4108 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4111 operator==(
const _CharT* __lhs,
4112 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
4113 {
return __rhs == __lhs; }
4122 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4128 {
return !(__lhs == __rhs); }
4136 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4139 operator!=(
const _CharT* __lhs,
4141 {
return !(__rhs == __lhs); }
4149 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4153 const _CharT* __rhs)
4154 {
return !(__lhs == __rhs); }
4163 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4169 {
return __lhs.compare(__rhs) < 0; }
4177 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4181 const _CharT* __rhs)
4182 {
return __lhs.compare(__rhs) < 0; }
4190 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4193 operator<(
const _CharT* __lhs,
4195 {
return __rhs.compare(__lhs) > 0; }
4204 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4210 {
return __lhs.compare(__rhs) > 0; }
4218 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4222 const _CharT* __rhs)
4223 {
return __lhs.compare(__rhs) > 0; }
4231 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4234 operator>(
const _CharT* __lhs,
4236 {
return __rhs.compare(__lhs) < 0; }
4245 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4251 {
return __lhs.compare(__rhs) <= 0; }
4259 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4263 const _CharT* __rhs)
4264 {
return __lhs.compare(__rhs) <= 0; }
4272 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4275 operator<=(
const _CharT* __lhs,
4277 {
return __rhs.compare(__lhs) >= 0; }
4286 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4292 {
return __lhs.compare(__rhs) >= 0; }
4300 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4304 const _CharT* __rhs)
4305 {
return __lhs.compare(__rhs) >= 0; }
4313 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4316 operator>=(
const _CharT* __lhs,
4318 {
return __rhs.compare(__lhs) <= 0; }
4328 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4329 _GLIBCXX20_CONSTEXPR
4333 _GLIBCXX_NOEXCEPT_IF(
noexcept(__lhs.swap(__rhs)))
4334 { __lhs.swap(__rhs); }
4349 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4350 basic_istream<_CharT, _Traits>&
4351 operator>>(basic_istream<_CharT, _Traits>& __is,
4352 basic_string<_CharT, _Traits, _Alloc>& __str);
4355 basic_istream<char>&
4367 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4374 return __ostream_insert(__os, __str.
data(), __str.
size());
4390 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4391 basic_istream<_CharT, _Traits>&
4392 getline(basic_istream<_CharT, _Traits>& __is,
4393 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
4407 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4408 inline basic_istream<_CharT, _Traits>&
4413#if __cplusplus >= 201103L
4415 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4416 inline basic_istream<_CharT, _Traits>&
4422 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4423 inline basic_istream<_CharT, _Traits>&
4430 basic_istream<char>&
4431 getline(basic_istream<char>& __in, basic_string<char>& __str,
4434#ifdef _GLIBCXX_USE_WCHAR_T
4436 basic_istream<wchar_t>&
4437 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
4441_GLIBCXX_END_NAMESPACE_VERSION
4444#if __cplusplus >= 201103L
4449namespace std _GLIBCXX_VISIBILITY(default)
4451_GLIBCXX_BEGIN_NAMESPACE_VERSION
4452_GLIBCXX_BEGIN_NAMESPACE_CXX11
4456 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4457 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
4461 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4462 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
4465 inline unsigned long
4466 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4467 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
4470#if _GLIBCXX_USE_C99_STDLIB
4472 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4473 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
4476 inline unsigned long long
4477 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4478 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
4480#elif __LONG_WIDTH__ == __LONG_LONG_WIDTH__
4482 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4483 {
return std::stol(__str, __idx, __base); }
4485 inline unsigned long long
4486 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
4487 {
return std::stoul(__str, __idx, __base); }
4491 stod(
const string& __str,
size_t* __idx = 0)
4492 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
4494#if _GLIBCXX_HAVE_STRTOF
4497 stof(
const string& __str,
size_t* __idx = 0)
4498 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
4501 stof(
const string& __str,
size_t* __idx = 0)
4503 double __d = std::stod(__str, __idx);
4504 if (__builtin_isfinite(__d) && __d != 0.0)
4506 double __abs_d = __builtin_fabs(__d);
4507 if (__abs_d < __FLT_MIN__ || __abs_d > __FLT_MAX__)
4510 std::__throw_out_of_range(
"stof");
4517#if _GLIBCXX_HAVE_STRTOLD && ! _GLIBCXX_HAVE_BROKEN_STRTOLD
4519 stold(
const string& __str,
size_t* __idx = 0)
4520 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
4521#elif __DBL_MANT_DIG__ == __LDBL_MANT_DIG__
4523 stold(
const string& __str,
size_t* __idx = 0)
4524 {
return std::stod(__str, __idx); }
4532 to_string(
int __val)
4533#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4537 const bool __neg = __val < 0;
4538 const unsigned __uval = __neg ? (unsigned)~__val + 1u : __val;
4539 const auto __len = __detail::__to_chars_len(__uval);
4541 __str.__resize_and_overwrite(__neg + __len, [=](
char* __p,
size_t __n) {
4543 __detail::__to_chars_10_impl(__p + (
int)__neg, __len, __uval);
4551 to_string(
unsigned __val)
4552#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32
4556 const auto __len = __detail::__to_chars_len(__val);
4558 __str.__resize_and_overwrite(__len, [__val](
char* __p,
size_t __n) {
4559 __detail::__to_chars_10_impl(__p, __n, __val);
4567 to_string(
long __val)
4568#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4572 const bool __neg = __val < 0;
4573 const unsigned long __uval = __neg ? (
unsigned long)~__val + 1ul : __val;
4574 const auto __len = __detail::__to_chars_len(__uval);
4576 __str.__resize_and_overwrite(__neg + __len, [=](
char* __p,
size_t __n) {
4578 __detail::__to_chars_10_impl(__p + (
int)__neg, __len, __uval);
4586 to_string(
unsigned long __val)
4587#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32
4591 const auto __len = __detail::__to_chars_len(__val);
4593 __str.__resize_and_overwrite(__len, [__val](
char* __p,
size_t __n) {
4594 __detail::__to_chars_10_impl(__p, __n, __val);
4602 to_string(
long long __val)
4604 const bool __neg = __val < 0;
4605 const unsigned long long __uval
4606 = __neg ? (
unsigned long long)~__val + 1ull : __val;
4607 const auto __len = __detail::__to_chars_len(__uval);
4609 __str.__resize_and_overwrite(__neg + __len, [=](
char* __p,
size_t __n) {
4611 __detail::__to_chars_10_impl(__p + (
int)__neg, __len, __uval);
4619 to_string(
unsigned long long __val)
4621 const auto __len = __detail::__to_chars_len(__val);
4623 __str.__resize_and_overwrite(__len, [__val](
char* __p,
size_t __n) {
4624 __detail::__to_chars_10_impl(__p, __n, __val);
4630#if __glibcxx_to_string >= 202306L
4634 to_string(
float __val)
4639 __str.resize_and_overwrite(__len,
4640 [__val, &__len] (
char* __p,
size_t __n) {
4641 auto [__end, __err] = std::to_chars(__p, __p + __n, __val);
4642 if (__err == errc{}) [[likely]]
4647 }
while (__str.empty());
4653 to_string(
double __val)
4658 __str.resize_and_overwrite(__len,
4659 [__val, &__len] (
char* __p,
size_t __n) {
4660 auto [__end, __err] = std::to_chars(__p, __p + __n, __val);
4661 if (__err == errc{}) [[likely]]
4666 }
while (__str.empty());
4672 to_string(
long double __val)
4677 __str.resize_and_overwrite(__len,
4678 [__val, &__len] (
char* __p,
size_t __n) {
4679 auto [__end, __err] = std::to_chars(__p, __p + __n, __val);
4680 if (__err == errc{}) [[likely]]
4685 }
while (__str.empty());
4688#elif _GLIBCXX_USE_C99_STDIO
4689#pragma GCC diagnostic push
4690#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
4695 to_string(
float __val)
4698 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
4699 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4705 to_string(
double __val)
4708 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
4709 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4715 to_string(
long double __val)
4718 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
4719 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
4722#pragma GCC diagnostic pop
4725#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
4727 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4728 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
4732 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4733 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
4736 inline unsigned long
4737 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4738 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
4742 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4743 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
4746 inline unsigned long long
4747 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
4748 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
4753 stof(
const wstring& __str,
size_t* __idx = 0)
4754 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
4757 stod(
const wstring& __str,
size_t* __idx = 0)
4758 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
4761 stold(
const wstring& __str,
size_t* __idx = 0)
4762 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
4765#ifdef _GLIBCXX_USE_WCHAR_T
4766#pragma GCC diagnostic push
4767#pragma GCC diagnostic ignored "-Wc++17-extensions"
4768 _GLIBCXX20_CONSTEXPR
4770 __to_wstring_numeric(
const char* __s,
int __len,
wchar_t* __wout)
4774 if constexpr (wchar_t(
'0') == L
'0' && wchar_t(
'-') == L
'-'
4775 && wchar_t(
'.') == L
'.' && wchar_t(
'e') == L
'e')
4777 for (
int __i = 0; __i < __len; ++__i)
4778 __wout[__i] = (
wchar_t) __s[__i];
4783 for (
int __i =
'0'; __i <=
'9'; ++__i)
4784 __wc[__i] = L
'0' + __i;
4809 for (
int __i = 0; __i < __len; ++__i)
4810 __wout[__i] = __wc[(
int)__s[__i]];
4814#if __glibcxx_constexpr_string >= 201907L
4818#ifdef __glibcxx_string_view
4819 __to_wstring_numeric(string_view __s)
4821 __to_wstring_numeric(
const string& __s)
4824 if constexpr (wchar_t(
'0') == L
'0' && wchar_t(
'-') == L
'-'
4825 && wchar_t(
'.') == L
'.' && wchar_t(
'e') == L
'e')
4826 return wstring(__s.data(), __s.data() + __s.size());
4830 auto __f = __s.data();
4831 __ws.__resize_and_overwrite(__s.size(),
4832 [__f] (
wchar_t* __to,
int __n) {
4833 std::__to_wstring_numeric(__f, __n, __to);
4839#pragma GCC diagnostic pop
4843 to_wstring(
int __val)
4844 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4848 to_wstring(
unsigned __val)
4849 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4853 to_wstring(
long __val)
4854 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4858 to_wstring(
unsigned long __val)
4859 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4863 to_wstring(
long long __val)
4864 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4868 to_wstring(
unsigned long long __val)
4869 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4871#if __glibcxx_to_string || _GLIBCXX_USE_C99_STDIO
4874 to_wstring(
float __val)
4875 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4879 to_wstring(
double __val)
4880 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4884 to_wstring(
long double __val)
4885 {
return std::__to_wstring_numeric(std::to_string(__val)); }
4889_GLIBCXX_END_NAMESPACE_CXX11
4890_GLIBCXX_END_NAMESPACE_VERSION
4895#if __cplusplus >= 201103L
4899namespace std _GLIBCXX_VISIBILITY(default)
4901_GLIBCXX_BEGIN_NAMESPACE_VERSION
4906 template<
typename _CharT,
typename _Alloc,
4908 struct __str_hash_base
4909 :
public __hash_base<size_t, _StrT>
4913 operator()(
const _StrT& __s)
const noexcept
4914 {
return _Hash_impl::hash(__s.data(), __s.length() *
sizeof(_CharT)); }
4917#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
4919 template<
typename _Alloc>
4921 :
public __str_hash_base<char, _Alloc>
4925 template<
typename _Alloc>
4927 :
public __str_hash_base<wchar_t, _Alloc>
4930 template<
typename _Alloc>
4937#ifdef _GLIBCXX_USE_CHAR8_T
4939 template<
typename _Alloc>
4940 struct hash<basic_string<char8_t, char_traits<char8_t>, _Alloc>>
4941 :
public __str_hash_base<char8_t, _Alloc>
4946 template<
typename _Alloc>
4948 :
public __str_hash_base<char16_t, _Alloc>
4952 template<
typename _Alloc>
4954 :
public __str_hash_base<char32_t, _Alloc>
4957#if ! _GLIBCXX_INLINE_VERSION
4963#ifdef _GLIBCXX_USE_CHAR8_T
4968 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4974#ifdef __glibcxx_string_udls
4977 inline namespace string_literals
4979#pragma GCC diagnostic push
4980#pragma GCC diagnostic ignored "-Wliteral-suffix"
4982#if __glibcxx_constexpr_string >= 201907L
4983# define _GLIBCXX_STRING_CONSTEXPR constexpr
4985# define _GLIBCXX_STRING_CONSTEXPR
4988 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4989 inline basic_string<char>
4990 operator""s(
const char* __str,
size_t __len)
4991 {
return basic_string<char>{__str, __len}; }
4993 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
4994 inline basic_string<wchar_t>
4995 operator""s(
const wchar_t* __str,
size_t __len)
4996 {
return basic_string<wchar_t>{__str, __len}; }
4998#ifdef _GLIBCXX_USE_CHAR8_T
4999 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
5000 inline basic_string<char8_t>
5001 operator""s(
const char8_t* __str,
size_t __len)
5002 {
return basic_string<char8_t>{__str, __len}; }
5005 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
5006 inline basic_string<char16_t>
5007 operator""s(
const char16_t* __str,
size_t __len)
5008 {
return basic_string<char16_t>{__str, __len}; }
5010 _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR
5011 inline basic_string<char32_t>
5012 operator""s(
const char32_t* __str,
size_t __len)
5013 {
return basic_string<char32_t>{__str, __len}; }
5015#undef _GLIBCXX_STRING_CONSTEXPR
5016#pragma GCC diagnostic pop
5021#ifdef __glibcxx_variant
5022 namespace __detail::__variant
5024 template<
typename>
struct _Never_valueless_alt;
5028 template<
typename _Tp,
typename _Traits,
typename _Alloc>
5029 struct _Never_valueless_alt<std::basic_string<_Tp, _Traits, _Alloc>>
5031 is_nothrow_move_constructible<std::basic_string<_Tp, _Traits, _Alloc>>,
5032 is_nothrow_move_assignable<std::basic_string<_Tp, _Traits, _Alloc>>
5038_GLIBCXX_END_NAMESPACE_VERSION
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
constexpr _Tp * to_address(_Tp *__ptr) noexcept
Obtain address referenced by a pointer to an object.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
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< char > string
A string of char.
basic_string< char32_t > u32string
A string of char32_t.
basic_string< char16_t > u16string
A string of char16_t.
basic_string< wchar_t > wstring
A string of wchar_t.
ISO C++ entities toplevel namespace is std.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
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.
ISO C++ inline namespace for literal suffixes.
char_type widen(char __c) const
Widens characters.
Template class basic_istream.
Template class basic_ostream.
A non-owning reference to a string.
Primary class template hash.
is_nothrow_default_constructible
The standard allocator, as per C++03 [20.4.1].
Managing sequences of characters and character-like objects.
constexpr const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
constexpr basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())
Construct string as copy of a range.
constexpr basic_string(const _Alloc &__a) noexcept
Construct an empty string using allocator a.
constexpr size_type find_first_not_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a different character.
constexpr basic_string & append(const basic_string &__str, size_type __pos, size_type __n=npos)
Append a substring.
constexpr basic_string() noexcept(/*conditional */)
Default constructor creates an empty string.
constexpr reference at(size_type __n)
Provides access to the data contained in the string.
constexpr basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
constexpr size_type find(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a C string.
constexpr basic_string & replace(__const_iterator __i1, __const_iterator __i2, const basic_string &__str)
Replace range of characters with string.
constexpr size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
constexpr basic_string(const _CharT *__s, const _Alloc &__a=_Alloc())
Construct string as copy of a C string.
constexpr const_iterator begin() const noexcept
constexpr void clear() noexcept
constexpr size_type find_last_not_of(const basic_string &__str, size_type __pos=npos) const noexcept
constexpr basic_string & operator=(const _CharT *__s)
Copy contents of s into this string.
constexpr const_reverse_iterator rend() const noexcept
constexpr void reserve(size_type __res_arg)
Attempt to preallocate enough memory for specified number of characters.
constexpr size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
constexpr basic_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
constexpr basic_string & replace(__const_iterator __i1, __const_iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
constexpr const _CharT * data() const noexcept
Return const pointer to contents.
constexpr void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
constexpr size_type find_first_not_of(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a character not in C substring.
constexpr basic_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
constexpr size_type find_first_of(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a character of C string.
constexpr int compare(size_type __pos, size_type __n, const basic_string &__str) const
Compare substring to a string.
constexpr int compare(size_type __pos1, size_type __n1, const basic_string &__str, size_type __pos2, size_type __n2=npos) const
Compare substring to a substring.
constexpr size_type rfind(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
constexpr reference back() noexcept
constexpr size_type find_first_of(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a character of C substring.
constexpr basic_string(const basic_string &__str, size_type __pos, const _Alloc &__a=_Alloc())
Construct string as copy of a substring.
constexpr basic_string(const basic_string &__str, size_type __pos, size_type __n)
Construct string as copy of a substring.
constexpr basic_string & replace(const_iterator __i1, const_iterator __i2, initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
constexpr basic_string & assign(initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
constexpr size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
constexpr size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a character not in C string.
constexpr basic_string & operator+=(const _CharT *__s)
Append a C string.
constexpr basic_string & assign(const basic_string &__str)
Set value to contents of another string.
constexpr basic_string(const basic_string &__str)
Construct string with copy of value of __str.
constexpr basic_string & append(initializer_list< _CharT > __l)
Append an initializer_list of characters.
constexpr basic_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
constexpr basic_string & append(size_type __n, _CharT __c)
Append multiple characters.
constexpr size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
constexpr const_reverse_iterator crbegin() const noexcept
constexpr basic_string(const basic_string &__str, size_type __pos, size_type __n, const _Alloc &__a)
Construct string as copy of a substring.
constexpr size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
constexpr basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
Replace characters with value of a C substring.
constexpr basic_string & assign(basic_string &&__str) noexcept(_Alloc_traits::_S_nothrow_move())
Set value to contents of another string.
constexpr basic_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
constexpr basic_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
constexpr const_reverse_iterator rbegin() const noexcept
constexpr size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
constexpr const_iterator end() const noexcept
constexpr basic_string & insert(size_type __pos, const _CharT *__s, size_type __n)
Insert a C substring.
constexpr size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a character not in C string.
constexpr const_iterator cbegin() const noexcept
constexpr size_type rfind(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find last position of a C substring.
constexpr iterator erase(__const_iterator __first, __const_iterator __last)
Remove a range of characters.
constexpr size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
constexpr const_reference at(size_type __n) const
Provides access to the data contained in the string.
constexpr reference operator[](size_type __pos)
Subscript access to the data contained in the string.
constexpr basic_string & assign(const basic_string &__str, size_type __pos, size_type __n=npos)
Set value to a substring of a string.
constexpr reverse_iterator rend() noexcept
constexpr void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
constexpr iterator insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
constexpr size_type find_last_not_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a different character.
constexpr basic_string & insert(size_type __pos1, const basic_string &__str)
Insert value of a string.
constexpr iterator insert(__const_iterator __p, _CharT __c)
Insert one character.
constexpr ~basic_string()
Destroy the string instance.
constexpr void __resize_and_overwrite(size_type __n, _Operation __op)
Non-standard version of resize_and_overwrite for C++11 and above.
constexpr size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
constexpr basic_string & append(const basic_string &__str)
Append a string to this string.
constexpr basic_string & operator+=(initializer_list< _CharT > __l)
Append an initializer_list of characters.
constexpr const_reference back() const noexcept
constexpr basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
constexpr size_type find_last_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
constexpr reference front() noexcept
constexpr iterator end() noexcept
constexpr basic_string & append(const _CharT *__s)
Append a C string.
constexpr iterator begin() noexcept
constexpr basic_string & replace(__const_iterator __i1, __const_iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
constexpr size_type find(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a string.
constexpr basic_string & replace(__const_iterator __i1, __const_iterator __i2, const _CharT *__s)
Replace range of characters with C string.
constexpr basic_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
constexpr void push_back(_CharT __c)
Append a single character.
constexpr reverse_iterator rbegin() noexcept
constexpr basic_string & operator=(initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
constexpr void resize(size_type __n)
Resizes the string to the specified number of characters.
constexpr size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
constexpr basic_string & assign(const _CharT *__s)
Set value to contents of a C string.
constexpr basic_string & insert(size_type __pos1, const basic_string &__str, size_type __pos2, size_type __n=npos)
Insert a substring.
constexpr basic_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
constexpr iterator insert(const_iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
constexpr size_type find_last_of(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find last position of a character of C substring.
constexpr size_type capacity() const noexcept
constexpr basic_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
constexpr bool empty() const noexcept
constexpr basic_string & replace(size_type __pos1, size_type __n1, const basic_string &__str, size_type __pos2, size_type __n2=npos)
Replace characters with value from another string.
constexpr int compare(const _CharT *__s) const noexcept
Compare to a C string.
static const size_type npos
constexpr basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
constexpr size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
constexpr basic_string & replace(const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
constexpr iterator erase(__const_iterator __position)
Remove one character.
constexpr allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
constexpr size_type find(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
constexpr basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
constexpr basic_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
constexpr const_reverse_iterator crend() const noexcept
constexpr basic_string & operator+=(_CharT __c)
Append a character.
constexpr basic_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
constexpr const_reference front() const noexcept
constexpr int compare(const basic_string &__str) const
Compare to a string.
constexpr int compare(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2) const
Compare substring against a character array.
constexpr size_type find_last_not_of(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find last position of a character not in C substring.
constexpr basic_string(initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
constexpr _CharT * data() noexcept
Return non-const pointer to contents.
constexpr basic_string & append(const _CharT *__s, size_type __n)
Append a C substring.
constexpr size_type max_size() const noexcept
Returns the size() of the largest possible string.
constexpr void swap(basic_string &__s) noexcept
Swap contents with another string.
constexpr basic_string(basic_string &&__str) noexcept
Move construct string.
constexpr const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
constexpr void pop_back() noexcept
Remove the last character.
constexpr int compare(size_type __pos, size_type __n1, const _CharT *__s) const
Compare substring to a C string.
constexpr basic_string & operator+=(const basic_string &__str)
Append a string to this string.
constexpr iterator insert(const_iterator __p, initializer_list< _CharT > __l)
Insert an initializer_list of characters.
constexpr const_iterator cend() const noexcept
constexpr basic_string & operator=(_CharT __c)
Set value to string of length 1.
constexpr size_type find_last_of(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a character of C string.
Basis for explicit traits specializations.
Forward iterators support a superset of input iterator operations.
Traits class for iterators.
Class std::basic_string with safety/checking/debug instrumentation.
Uniform interface to C++98 and C++11 allocators.
static constexpr pointer allocate(_Char_alloc_type &__a, size_type __n)
static constexpr void deallocate(_Char_alloc_type &__a, pointer __p, size_type __n)
static constexpr size_type max_size(const _Char_alloc_type &__a) noexcept