34 #ifndef _BASIC_STRING_H 35 #define _BASIC_STRING_H 1 37 #pragma GCC system_header 43 #if __cplusplus >= 201103L 47 #if __cplusplus > 201402L 52 namespace std _GLIBCXX_VISIBILITY(default)
54 _GLIBCXX_BEGIN_NAMESPACE_VERSION
56 #if _GLIBCXX_USE_CXX11_ABI 57 _GLIBCXX_BEGIN_NAMESPACE_CXX11
76 template<
typename _CharT,
typename _Traits,
typename _Alloc>
80 rebind<_CharT>::other _Char_alloc_type;
85 typedef _Traits traits_type;
86 typedef typename _Traits::char_type value_type;
87 typedef _Char_alloc_type allocator_type;
88 typedef typename _Alloc_traits::size_type size_type;
89 typedef typename _Alloc_traits::difference_type difference_type;
90 typedef typename _Alloc_traits::reference reference;
91 typedef typename _Alloc_traits::const_reference const_reference;
92 typedef typename _Alloc_traits::pointer pointer;
93 typedef typename _Alloc_traits::const_pointer const_pointer;
94 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
95 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
101 static const size_type
npos = static_cast<size_type>(-1);
105 #if __cplusplus < 201103L 106 typedef iterator __const_iterator;
108 typedef const_iterator __const_iterator;
111 #if __cplusplus > 201402L 113 typedef basic_string_view<_CharT, _Traits> __sv_type;
115 template<
typename _Tp,
typename _Res>
117 __and_<is_convertible<const _Tp&, __sv_type>,
118 __not_<is_convertible<const _Tp*, const basic_string*>>,
119 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
124 _S_to_string_view(__sv_type __svt) noexcept
133 explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
139 struct _Alloc_hider : allocator_type
141 #if __cplusplus < 201103L 142 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
143 : allocator_type(__a), _M_p(__dat) { }
145 _Alloc_hider(pointer __dat,
const _Alloc& __a)
146 : allocator_type(__a), _M_p(__dat) { }
148 _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc())
149 : allocator_type(
std::move(__a)), _M_p(__dat) { }
155 _Alloc_hider _M_dataplus;
156 size_type _M_string_length;
158 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
162 _CharT _M_local_buf[_S_local_capacity + 1];
163 size_type _M_allocated_capacity;
168 { _M_dataplus._M_p = __p; }
171 _M_length(size_type __length)
172 { _M_string_length = __length; }
176 {
return _M_dataplus._M_p; }
181 #if __cplusplus >= 201103L 184 return pointer(_M_local_buf);
189 _M_local_data()
const 191 #if __cplusplus >= 201103L 194 return const_pointer(_M_local_buf);
199 _M_capacity(size_type __capacity)
200 { _M_allocated_capacity = __capacity; }
203 _M_set_length(size_type __n)
206 traits_type::assign(_M_data()[__n], _CharT());
211 {
return _M_data() == _M_local_data(); }
215 _M_create(size_type&, size_type);
221 _M_destroy(_M_allocated_capacity);
225 _M_destroy(size_type __size)
throw()
226 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
230 template<
typename _InIterator>
232 _M_construct_aux(_InIterator __beg, _InIterator __end,
235 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
236 _M_construct(__beg, __end, _Tag());
241 template<
typename _Integer>
243 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
244 { _M_construct_aux_2(static_cast<size_type>(__beg), __end); }
247 _M_construct_aux_2(size_type __req, _CharT __c)
248 { _M_construct(__req, __c); }
250 template<
typename _InIterator>
252 _M_construct(_InIterator __beg, _InIterator __end)
254 typedef typename std::__is_integer<_InIterator>::__type _Integral;
255 _M_construct_aux(__beg, __end, _Integral());
259 template<
typename _InIterator>
261 _M_construct(_InIterator __beg, _InIterator __end,
266 template<
typename _FwdIterator>
268 _M_construct(_FwdIterator __beg, _FwdIterator __end,
272 _M_construct(size_type __req, _CharT __c);
276 {
return _M_dataplus; }
278 const allocator_type&
279 _M_get_allocator()
const 280 {
return _M_dataplus; }
284 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 287 template<
typename _Tp,
bool _Requires =
288 !__are_same<_Tp, _CharT*>::__value
289 && !__are_same<_Tp, const _CharT*>::__value
290 && !__are_same<_Tp, iterator>::__value
291 && !__are_same<_Tp, const_iterator>::__value>
292 struct __enable_if_not_native_iterator
294 template<
typename _Tp>
295 struct __enable_if_not_native_iterator<_Tp, false> { };
299 _M_check(size_type __pos,
const char* __s)
const 301 if (__pos > this->
size())
302 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 303 "this->size() (which is %zu)"),
304 __s, __pos, this->
size());
309 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 312 __throw_length_error(__N(__s));
318 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
320 const bool __testoff = __off < this->
size() - __pos;
321 return __testoff ? __off : this->
size() - __pos;
326 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
328 return (less<const _CharT*>()(__s, _M_data())
329 || less<const _CharT*>()(_M_data() + this->
size(), __s));
335 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
338 traits_type::assign(*__d, *__s);
340 traits_type::copy(__d, __s, __n);
344 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
347 traits_type::assign(*__d, *__s);
349 traits_type::move(__d, __s, __n);
353 _S_assign(_CharT* __d, size_type __n, _CharT __c)
356 traits_type::assign(*__d, __c);
358 traits_type::assign(__d, __n, __c);
363 template<
class _Iterator>
365 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
367 for (; __k1 != __k2; ++__k1, (void)++__p)
368 traits_type::assign(*__p, *__k1);
372 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
373 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
376 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
378 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
381 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
382 { _S_copy(__p, __k1, __k2 - __k1); }
385 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
387 { _S_copy(__p, __k1, __k2 - __k1); }
390 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
392 const difference_type __d = difference_type(__n1 - __n2);
394 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
395 return __gnu_cxx::__numeric_traits<int>::__max;
396 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
397 return __gnu_cxx::__numeric_traits<int>::__min;
406 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
410 _M_erase(size_type __pos, size_type __n);
421 _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value)
422 : _M_dataplus(_M_local_data())
423 { _M_set_length(0); }
430 : _M_dataplus(_M_local_data(), __a)
431 { _M_set_length(0); }
438 : _M_dataplus(_M_local_data(),
439 _Alloc_traits::_S_select_on_copy(__str._M_get_allocator()))
440 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
451 const _Alloc& __a = _Alloc())
452 : _M_dataplus(_M_local_data(), __a)
454 const _CharT* __start = __str._M_data()
455 + __str._M_check(__pos,
"basic_string::basic_string");
456 _M_construct(__start, __start + __str._M_limit(__pos,
npos));
467 : _M_dataplus(_M_local_data())
469 const _CharT* __start = __str._M_data()
470 + __str._M_check(__pos,
"basic_string::basic_string");
471 _M_construct(__start, __start + __str._M_limit(__pos, __n));
482 size_type __n,
const _Alloc& __a)
483 : _M_dataplus(_M_local_data(), __a)
485 const _CharT* __start
486 = __str._M_data() + __str._M_check(__pos,
"string::string");
487 _M_construct(__start, __start + __str._M_limit(__pos, __n));
500 const _Alloc& __a = _Alloc())
501 : _M_dataplus(_M_local_data(), __a)
502 { _M_construct(__s, __s + __n); }
509 #if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS 512 template<
typename = _RequireAllocator<_Alloc>>
514 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc())
515 : _M_dataplus(_M_local_data(), __a)
516 { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+
npos); }
524 #if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS 527 template<
typename = _RequireAllocator<_Alloc>>
529 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc())
530 : _M_dataplus(_M_local_data(), __a)
531 { _M_construct(__n, __c); }
533 #if __cplusplus >= 201103L 542 : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator()))
544 if (__str._M_is_local())
546 traits_type::copy(_M_local_buf, __str._M_local_buf,
547 _S_local_capacity + 1);
551 _M_data(__str._M_data());
552 _M_capacity(__str._M_allocated_capacity);
558 _M_length(__str.length());
559 __str._M_data(__str._M_local_data());
560 __str._M_set_length(0);
568 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
569 : _M_dataplus(_M_local_data(), __a)
570 { _M_construct(__l.begin(), __l.end()); }
573 : _M_dataplus(_M_local_data(), __a)
574 { _M_construct(__str.begin(), __str.end()); }
577 noexcept(_Alloc_traits::_S_always_equal())
578 : _M_dataplus(_M_local_data(), __a)
580 if (__str._M_is_local())
582 traits_type::copy(_M_local_buf, __str._M_local_buf,
583 _S_local_capacity + 1);
584 _M_length(__str.length());
585 __str._M_set_length(0);
587 else if (_Alloc_traits::_S_always_equal()
588 || __str.get_allocator() == __a)
590 _M_data(__str._M_data());
591 _M_length(__str.length());
592 _M_capacity(__str._M_allocated_capacity);
593 __str._M_data(__str._M_local_buf);
594 __str._M_set_length(0);
597 _M_construct(__str.begin(), __str.end());
608 #if __cplusplus >= 201103L 609 template<
typename _InputIterator,
610 typename = std::_RequireInputIter<_InputIterator>>
612 template<
typename _InputIterator>
614 basic_string(_InputIterator __beg, _InputIterator __end,
615 const _Alloc& __a = _Alloc())
616 : _M_dataplus(_M_local_data(), __a)
617 { _M_construct(__beg, __end); }
619 #if __cplusplus > 201402L 627 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
628 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
629 const _Alloc& __a = _Alloc())
637 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
639 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
640 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
666 #if __cplusplus >= 201103L 667 if (_Alloc_traits::_S_propagate_on_copy_assign())
669 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
670 && _M_get_allocator() != __str._M_get_allocator())
674 if (__str.size() <= _S_local_capacity)
676 _M_destroy(_M_allocated_capacity);
677 _M_data(_M_local_data());
682 const auto __len = __str.size();
683 auto __alloc = __str._M_get_allocator();
685 auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
686 _M_destroy(_M_allocated_capacity);
689 _M_set_length(__len);
692 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
695 return this->
assign(__str);
704 {
return this->
assign(__s); }
720 #if __cplusplus >= 201103L 733 noexcept(_Alloc_traits::_S_nothrow_move())
735 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
736 && !_Alloc_traits::_S_always_equal()
737 && _M_get_allocator() != __str._M_get_allocator())
740 _M_destroy(_M_allocated_capacity);
741 _M_data(_M_local_data());
745 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
747 if (__str._M_is_local())
751 this->_S_copy(_M_data(), __str._M_data(), __str.size());
752 _M_set_length(__str.size());
754 else if (_Alloc_traits::_S_propagate_on_move_assign()
755 || _Alloc_traits::_S_always_equal()
756 || _M_get_allocator() == __str._M_get_allocator())
759 pointer __data =
nullptr;
760 size_type __capacity;
763 if (_Alloc_traits::_S_always_equal())
767 __capacity = _M_allocated_capacity;
770 _M_destroy(_M_allocated_capacity);
773 _M_data(__str._M_data());
774 _M_length(__str.length());
775 _M_capacity(__str._M_allocated_capacity);
778 __str._M_data(__data);
779 __str._M_capacity(__capacity);
782 __str._M_data(__str._M_local_buf);
797 this->
assign(__l.begin(), __l.size());
802 #if __cplusplus > 201402L 807 template<
typename _Tp>
808 _If_sv<_Tp, basic_string&>
810 {
return this->
assign(__svt); }
816 operator __sv_type() const noexcept
817 {
return __sv_type(
data(),
size()); }
826 begin() _GLIBCXX_NOEXCEPT
827 {
return iterator(_M_data()); }
834 begin() const _GLIBCXX_NOEXCEPT
835 {
return const_iterator(_M_data()); }
842 end() _GLIBCXX_NOEXCEPT
843 {
return iterator(_M_data() + this->
size()); }
850 end() const _GLIBCXX_NOEXCEPT
851 {
return const_iterator(_M_data() + this->
size()); }
859 rbegin() _GLIBCXX_NOEXCEPT
860 {
return reverse_iterator(this->
end()); }
867 const_reverse_iterator
868 rbegin() const _GLIBCXX_NOEXCEPT
869 {
return const_reverse_iterator(this->
end()); }
877 rend() _GLIBCXX_NOEXCEPT
878 {
return reverse_iterator(this->
begin()); }
885 const_reverse_iterator
886 rend() const _GLIBCXX_NOEXCEPT
887 {
return const_reverse_iterator(this->
begin()); }
889 #if __cplusplus >= 201103L 896 {
return const_iterator(this->_M_data()); }
903 cend() const noexcept
904 {
return const_iterator(this->_M_data() + this->
size()); }
911 const_reverse_iterator
913 {
return const_reverse_iterator(this->
end()); }
920 const_reverse_iterator
921 crend() const noexcept
922 {
return const_reverse_iterator(this->
begin()); }
930 size() const _GLIBCXX_NOEXCEPT
931 {
return _M_string_length; }
936 length() const _GLIBCXX_NOEXCEPT
937 {
return _M_string_length; }
942 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
955 resize(size_type __n, _CharT __c);
969 { this->
resize(__n, _CharT()); }
971 #if __cplusplus >= 201103L 995 return _M_is_local() ? size_type(_S_local_capacity)
996 : _M_allocated_capacity;
1017 reserve(size_type __res_arg = 0);
1023 clear() _GLIBCXX_NOEXCEPT
1024 { _M_set_length(0); }
1031 empty() const _GLIBCXX_NOEXCEPT
1032 {
return this->
size() == 0; }
1046 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
1048 __glibcxx_assert(__pos <=
size());
1049 return _M_data()[__pos];
1067 __glibcxx_assert(__pos <=
size());
1069 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1070 return _M_data()[__pos];
1084 at(size_type __n)
const 1086 if (__n >= this->
size())
1087 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 1088 "(which is %zu) >= this->size() " 1091 return _M_data()[__n];
1108 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 1109 "(which is %zu) >= this->size() " 1112 return _M_data()[__n];
1115 #if __cplusplus >= 201103L 1123 __glibcxx_assert(!
empty());
1132 front() const noexcept
1134 __glibcxx_assert(!
empty());
1145 __glibcxx_assert(!
empty());
1154 back() const noexcept
1156 __glibcxx_assert(!
empty());
1169 {
return this->
append(__str); }
1178 {
return this->
append(__s); }
1192 #if __cplusplus >= 201103L 1200 {
return this->
append(__l.begin(), __l.size()); }
1203 #if __cplusplus > 201402L 1209 template<
typename _Tp>
1210 _If_sv<_Tp, basic_string&>
1212 {
return this->
append(__svt); }
1222 {
return _M_append(__str._M_data(), __str.size()); }
1239 {
return _M_append(__str._M_data()
1240 + __str._M_check(__pos,
"basic_string::append"),
1241 __str._M_limit(__pos, __n)); }
1250 append(
const _CharT* __s, size_type __n)
1252 __glibcxx_requires_string_len(__s, __n);
1253 _M_check_length(size_type(0), __n,
"basic_string::append");
1254 return _M_append(__s, __n);
1263 append(
const _CharT* __s)
1265 __glibcxx_requires_string(__s);
1266 const size_type __n = traits_type::length(__s);
1267 _M_check_length(size_type(0), __n,
"basic_string::append");
1268 return _M_append(__s, __n);
1280 append(size_type __n, _CharT __c)
1281 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1283 #if __cplusplus >= 201103L 1290 append(initializer_list<_CharT> __l)
1291 {
return this->
append(__l.begin(), __l.size()); }
1302 #if __cplusplus >= 201103L 1303 template<
class _InputIterator,
1304 typename = std::_RequireInputIter<_InputIterator>>
1306 template<
class _InputIterator>
1309 append(_InputIterator __first, _InputIterator __last)
1312 #if __cplusplus > 201402L 1318 template<
typename _Tp>
1319 _If_sv<_Tp, basic_string&>
1322 __sv_type __sv = __svt;
1323 return this->
append(__sv.data(), __sv.size());
1333 template<
typename _Tp>
1334 _If_sv<_Tp, basic_string&>
1335 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1337 __sv_type __sv = __svt;
1338 return _M_append(__sv.data()
1339 + __sv._M_check(__pos,
"basic_string::append"),
1340 __sv._M_limit(__pos, __n));
1351 const size_type __size = this->
size();
1353 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1354 traits_type::assign(this->_M_data()[__size], __c);
1355 this->_M_set_length(__size + 1);
1366 this->_M_assign(__str);
1370 #if __cplusplus >= 201103L 1381 noexcept(_Alloc_traits::_S_nothrow_move())
1385 return *
this = std::move(__str);
1404 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1405 + __str._M_check(__pos,
"basic_string::assign"),
1406 __str._M_limit(__pos, __n)); }
1419 assign(
const _CharT* __s, size_type __n)
1421 __glibcxx_requires_string_len(__s, __n);
1422 return _M_replace(size_type(0), this->
size(), __s, __n);
1435 assign(
const _CharT* __s)
1437 __glibcxx_requires_string(__s);
1438 return _M_replace(size_type(0), this->
size(), __s,
1439 traits_type::length(__s));
1452 assign(size_type __n, _CharT __c)
1453 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1463 #if __cplusplus >= 201103L 1464 template<
class _InputIterator,
1465 typename = std::_RequireInputIter<_InputIterator>>
1467 template<
class _InputIterator>
1470 assign(_InputIterator __first, _InputIterator __last)
1473 #if __cplusplus >= 201103L 1480 assign(initializer_list<_CharT> __l)
1481 {
return this->
assign(__l.begin(), __l.size()); }
1484 #if __cplusplus > 201402L 1490 template<
typename _Tp>
1491 _If_sv<_Tp, basic_string&>
1494 __sv_type __sv = __svt;
1495 return this->
assign(__sv.data(), __sv.size());
1505 template<
typename _Tp>
1506 _If_sv<_Tp, basic_string&>
1507 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
1509 __sv_type __sv = __svt;
1510 return _M_replace(size_type(0), this->
size(), __sv.data()
1511 + __sv._M_check(__pos,
"basic_string::assign"),
1512 __sv._M_limit(__pos, __n));
1516 #if __cplusplus >= 201103L 1533 insert(const_iterator __p, size_type __n, _CharT __c)
1535 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1536 const size_type __pos = __p -
begin();
1537 this->
replace(__p, __p, __n, __c);
1538 return iterator(this->_M_data() + __pos);
1555 insert(iterator __p, size_type __n, _CharT __c)
1556 { this->
replace(__p, __p, __n, __c); }
1559 #if __cplusplus >= 201103L 1574 template<
class _InputIterator,
1575 typename = std::_RequireInputIter<_InputIterator>>
1577 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1579 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1580 const size_type __pos = __p -
begin();
1581 this->
replace(__p, __p, __beg, __end);
1582 return iterator(this->_M_data() + __pos);
1597 template<
class _InputIterator>
1599 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1600 { this->
replace(__p, __p, __beg, __end); }
1603 #if __cplusplus >= 201103L 1611 insert(iterator __p, initializer_list<_CharT> __l)
1613 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1614 this->
insert(__p -
begin(), __l.begin(), __l.size());
1632 {
return this->
replace(__pos1, size_type(0),
1633 __str._M_data(), __str.size()); }
1655 size_type __pos2, size_type __n =
npos)
1656 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1657 + __str._M_check(__pos2,
"basic_string::insert"),
1658 __str._M_limit(__pos2, __n)); }
1677 insert(size_type __pos,
const _CharT* __s, size_type __n)
1678 {
return this->
replace(__pos, size_type(0), __s, __n); }
1696 insert(size_type __pos,
const _CharT* __s)
1698 __glibcxx_requires_string(__s);
1699 return this->
replace(__pos, size_type(0), __s,
1700 traits_type::length(__s));
1720 insert(size_type __pos, size_type __n, _CharT __c)
1721 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1722 size_type(0), __n, __c); }
1738 insert(__const_iterator __p, _CharT __c)
1740 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1741 const size_type __pos = __p -
begin();
1742 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1743 return iterator(_M_data() + __pos);
1746 #if __cplusplus > 201402L 1753 template<
typename _Tp>
1754 _If_sv<_Tp, basic_string&>
1755 insert(size_type __pos,
const _Tp& __svt)
1757 __sv_type __sv = __svt;
1758 return this->
insert(__pos, __sv.data(), __sv.size());
1770 template<
typename _Tp>
1771 _If_sv<_Tp, basic_string&>
1772 insert(size_type __pos1,
const _Tp& __svt,
1773 size_type __pos2, size_type __n =
npos)
1775 __sv_type __sv = __svt;
1776 return this->
replace(__pos1, size_type(0), __sv.data()
1777 + __sv._M_check(__pos2,
"basic_string::insert"),
1778 __sv._M_limit(__pos2, __n));
1798 erase(size_type __pos = 0, size_type __n =
npos)
1800 _M_check(__pos,
"basic_string::erase");
1802 this->_M_set_length(__pos);
1804 this->_M_erase(__pos, _M_limit(__pos, __n));
1817 erase(__const_iterator __position)
1819 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
1820 && __position <
end());
1821 const size_type __pos = __position -
begin();
1822 this->_M_erase(__pos, size_type(1));
1823 return iterator(_M_data() + __pos);
1836 erase(__const_iterator __first, __const_iterator __last)
1838 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
1839 && __last <=
end());
1840 const size_type __pos = __first -
begin();
1841 if (__last ==
end())
1842 this->_M_set_length(__pos);
1844 this->_M_erase(__pos, __last - __first);
1845 return iterator(this->_M_data() + __pos);
1848 #if __cplusplus >= 201103L 1857 __glibcxx_assert(!
empty());
1858 _M_erase(
size() - 1, 1);
1881 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
1903 size_type __pos2, size_type __n2 =
npos)
1904 {
return this->
replace(__pos1, __n1, __str._M_data()
1905 + __str._M_check(__pos2,
"basic_string::replace"),
1906 __str._M_limit(__pos2, __n2)); }
1927 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1930 __glibcxx_requires_string_len(__s, __n2);
1931 return _M_replace(_M_check(__pos,
"basic_string::replace"),
1932 _M_limit(__pos, __n1), __s, __n2);
1952 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1954 __glibcxx_requires_string(__s);
1955 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1976 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1977 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
1978 _M_limit(__pos, __n1), __n2, __c); }
1994 replace(__const_iterator __i1, __const_iterator __i2,
1996 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
2014 replace(__const_iterator __i1, __const_iterator __i2,
2015 const _CharT* __s, size_type __n)
2017 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2019 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2036 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2038 __glibcxx_requires_string(__s);
2039 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2057 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2060 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2062 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2080 #if __cplusplus >= 201103L 2081 template<
class _InputIterator,
2082 typename = std::_RequireInputIter<_InputIterator>>
2084 replace(const_iterator __i1, const_iterator __i2,
2085 _InputIterator __k1, _InputIterator __k2)
2087 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2089 __glibcxx_requires_valid_range(__k1, __k2);
2090 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2091 std::__false_type());
2094 template<
class _InputIterator>
2095 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 2096 typename __enable_if_not_native_iterator<_InputIterator>::__type
2100 replace(iterator __i1, iterator __i2,
2101 _InputIterator __k1, _InputIterator __k2)
2103 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2105 __glibcxx_requires_valid_range(__k1, __k2);
2106 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2107 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2114 replace(__const_iterator __i1, __const_iterator __i2,
2115 _CharT* __k1, _CharT* __k2)
2117 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2119 __glibcxx_requires_valid_range(__k1, __k2);
2125 replace(__const_iterator __i1, __const_iterator __i2,
2126 const _CharT* __k1,
const _CharT* __k2)
2128 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2130 __glibcxx_requires_valid_range(__k1, __k2);
2136 replace(__const_iterator __i1, __const_iterator __i2,
2137 iterator __k1, iterator __k2)
2139 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2141 __glibcxx_requires_valid_range(__k1, __k2);
2143 __k1.base(), __k2 - __k1);
2147 replace(__const_iterator __i1, __const_iterator __i2,
2148 const_iterator __k1, const_iterator __k2)
2150 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2152 __glibcxx_requires_valid_range(__k1, __k2);
2154 __k1.base(), __k2 - __k1);
2157 #if __cplusplus >= 201103L 2173 initializer_list<_CharT> __l)
2174 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2177 #if __cplusplus > 201402L 2185 template<
typename _Tp>
2186 _If_sv<_Tp, basic_string&>
2187 replace(size_type __pos, size_type __n,
const _Tp& __svt)
2189 __sv_type __sv = __svt;
2190 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2202 template<
typename _Tp>
2203 _If_sv<_Tp, basic_string&>
2204 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2205 size_type __pos2, size_type __n2 =
npos)
2207 __sv_type __sv = __svt;
2208 return this->
replace(__pos1, __n1, __sv.data()
2209 + __sv._M_check(__pos2,
"basic_string::replace"),
2210 __sv._M_limit(__pos2, __n2));
2222 template<
typename _Tp>
2223 _If_sv<_Tp, basic_string&>
2224 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2226 __sv_type __sv = __svt;
2227 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2232 template<
class _Integer>
2234 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2235 _Integer __n, _Integer __val, __true_type)
2236 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2238 template<
class _InputIterator>
2240 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2241 _InputIterator __k1, _InputIterator __k2,
2245 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2249 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2250 const size_type __len2);
2253 _M_append(
const _CharT* __s, size_type __n);
2270 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2290 c_str() const _GLIBCXX_NOEXCEPT
2291 {
return _M_data(); }
2302 data() const _GLIBCXX_NOEXCEPT
2303 {
return _M_data(); }
2305 #if __cplusplus > 201402L 2314 {
return _M_data(); }
2322 {
return _M_get_allocator(); }
2337 find(
const _CharT* __s, size_type __pos, size_type __n)
const 2353 {
return this->
find(__str.data(), __pos, __str.size()); }
2355 #if __cplusplus > 201402L 2362 template<
typename _Tp>
2363 _If_sv<_Tp, size_type>
2364 find(
const _Tp& __svt, size_type __pos = 0) const
2365 noexcept(is_same<_Tp, __sv_type>::value)
2367 __sv_type __sv = __svt;
2368 return this->
find(__sv.data(), __pos, __sv.size());
2383 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2385 __glibcxx_requires_string(__s);
2386 return this->
find(__s, __pos, traits_type::length(__s));
2400 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
2415 {
return this->
rfind(__str.data(), __pos, __str.size()); }
2417 #if __cplusplus > 201402L 2424 template<
typename _Tp>
2425 _If_sv<_Tp, size_type>
2426 rfind(
const _Tp& __svt, size_type __pos =
npos)
const 2427 noexcept(is_same<_Tp, __sv_type>::value)
2429 __sv_type __sv = __svt;
2430 return this->
rfind(__sv.data(), __pos, __sv.size());
2447 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const 2461 rfind(
const _CharT* __s, size_type __pos =
npos)
const 2463 __glibcxx_requires_string(__s);
2464 return this->
rfind(__s, __pos, traits_type::length(__s));
2478 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
2494 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2496 #if __cplusplus > 201402L 2504 template<
typename _Tp>
2505 _If_sv<_Tp, size_type>
2507 noexcept(is_same<_Tp, __sv_type>::value)
2509 __sv_type __sv = __svt;
2510 return this->
find_first_of(__sv.data(), __pos, __sv.size());
2527 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const 2544 __glibcxx_requires_string(__s);
2545 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2561 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2562 {
return this->
find(__c, __pos); }
2578 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2580 #if __cplusplus > 201402L 2588 template<
typename _Tp>
2589 _If_sv<_Tp, size_type>
2591 noexcept(is_same<_Tp, __sv_type>::value)
2593 __sv_type __sv = __svt;
2594 return this->
find_last_of(__sv.data(), __pos, __sv.size());
2611 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const 2628 __glibcxx_requires_string(__s);
2629 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2646 {
return this->
rfind(__c, __pos); }
2663 #if __cplusplus > 201402L 2671 template<
typename _Tp>
2672 _If_sv<_Tp, size_type>
2674 noexcept(is_same<_Tp, __sv_type>::value)
2676 __sv_type __sv = __svt;
2695 size_type __n)
const _GLIBCXX_NOEXCEPT;
2711 __glibcxx_requires_string(__s);
2745 #if __cplusplus > 201402L 2753 template<
typename _Tp>
2754 _If_sv<_Tp, size_type>
2756 noexcept(is_same<_Tp, __sv_type>::value)
2758 __sv_type __sv = __svt;
2777 size_type __n)
const _GLIBCXX_NOEXCEPT;
2793 __glibcxx_requires_string(__s);
2824 substr(size_type __pos = 0, size_type __n =
npos)
const 2826 _M_check(__pos,
"basic_string::substr"), __n); }
2845 const size_type __size = this->
size();
2846 const size_type __osize = __str.size();
2847 const size_type __len =
std::min(__size, __osize);
2849 int __r = traits_type::compare(_M_data(), __str.data(), __len);
2851 __r = _S_compare(__size, __osize);
2855 #if __cplusplus > 201402L 2861 template<
typename _Tp>
2863 compare(
const _Tp& __svt)
const 2864 noexcept(is_same<_Tp, __sv_type>::value)
2866 __sv_type __sv = __svt;
2867 const size_type __size = this->
size();
2868 const size_type __osize = __sv.size();
2869 const size_type __len =
std::min(__size, __osize);
2871 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
2873 __r = _S_compare(__size, __osize);
2885 template<
typename _Tp>
2887 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const 2888 noexcept(is_same<_Tp, __sv_type>::value)
2890 __sv_type __sv = __svt;
2891 return __sv_type(*this).substr(__pos, __n).compare(__sv);
2904 template<
typename _Tp>
2906 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
2907 size_type __pos2, size_type __n2 =
npos)
const 2908 noexcept(is_same<_Tp, __sv_type>::value)
2910 __sv_type __sv = __svt;
2911 return __sv_type(*
this)
2912 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
2963 size_type __pos2, size_type __n2 =
npos)
const;
2980 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
3004 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
3031 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3032 size_type __n2)
const;
3035 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3037 _GLIBCXX_END_NAMESPACE_CXX11
3038 #else // !_GLIBCXX_USE_CXX11_ABI 3103 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3106 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
3110 typedef _Traits traits_type;
3111 typedef typename _Traits::char_type value_type;
3112 typedef _Alloc allocator_type;
3113 typedef typename _CharT_alloc_type::size_type size_type;
3114 typedef typename _CharT_alloc_type::difference_type difference_type;
3115 typedef typename _CharT_alloc_type::reference reference;
3116 typedef typename _CharT_alloc_type::const_reference const_reference;
3117 typedef typename _CharT_alloc_type::pointer pointer;
3118 typedef typename _CharT_alloc_type::const_pointer const_pointer;
3119 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
3120 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
3142 size_type _M_length;
3143 size_type _M_capacity;
3144 _Atomic_word _M_refcount;
3147 struct _Rep : _Rep_base
3150 typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
3165 static const size_type _S_max_size;
3166 static const _CharT _S_terminal;
3170 static size_type _S_empty_rep_storage[];
3173 _S_empty_rep() _GLIBCXX_NOEXCEPT
3178 void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
3179 return *reinterpret_cast<_Rep*>(__p);
3183 _M_is_leaked()
const _GLIBCXX_NOEXCEPT
3185 #if defined(__GTHREADS) 3190 return __atomic_load_n(&this->_M_refcount, __ATOMIC_RELAXED) < 0;
3192 return this->_M_refcount < 0;
3197 _M_is_shared()
const _GLIBCXX_NOEXCEPT
3199 #if defined(__GTHREADS) 3205 return __atomic_load_n(&this->_M_refcount, __ATOMIC_ACQUIRE) > 0;
3207 return this->_M_refcount > 0;
3212 _M_set_leaked() _GLIBCXX_NOEXCEPT
3213 { this->_M_refcount = -1; }
3216 _M_set_sharable() _GLIBCXX_NOEXCEPT
3217 { this->_M_refcount = 0; }
3220 _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
3222 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3223 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3226 this->_M_set_sharable();
3227 this->_M_length = __n;
3228 traits_type::assign(this->_M_refdata()[__n], _S_terminal);
3235 _M_refdata()
throw()
3236 {
return reinterpret_cast<_CharT*>(
this + 1); }
3239 _M_grab(
const _Alloc& __alloc1,
const _Alloc& __alloc2)
3241 return (!_M_is_leaked() && __alloc1 == __alloc2)
3242 ? _M_refcopy() : _M_clone(__alloc1);
3247 _S_create(size_type, size_type,
const _Alloc&);
3250 _M_dispose(
const _Alloc& __a) _GLIBCXX_NOEXCEPT
3252 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3253 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3257 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
3266 if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
3269 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
3276 _M_destroy(
const _Alloc&)
throw();
3279 _M_refcopy()
throw()
3281 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3282 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3284 __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
3285 return _M_refdata();
3289 _M_clone(
const _Alloc&, size_type __res = 0);
3293 struct _Alloc_hider : _Alloc
3295 _Alloc_hider(_CharT* __dat,
const _Alloc& __a) _GLIBCXX_NOEXCEPT
3296 : _Alloc(__a), _M_p(__dat) { }
3306 static const size_type
npos = static_cast<size_type>(-1);
3310 mutable _Alloc_hider _M_dataplus;
3313 _M_data() const _GLIBCXX_NOEXCEPT
3314 {
return _M_dataplus._M_p; }
3317 _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
3318 {
return (_M_dataplus._M_p = __p); }
3321 _M_rep() const _GLIBCXX_NOEXCEPT
3322 {
return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
3327 _M_ibegin() const _GLIBCXX_NOEXCEPT
3328 {
return iterator(_M_data()); }
3331 _M_iend() const _GLIBCXX_NOEXCEPT
3332 {
return iterator(_M_data() + this->
size()); }
3337 if (!_M_rep()->_M_is_leaked())
3342 _M_check(size_type __pos,
const char* __s)
const 3344 if (__pos > this->
size())
3345 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 3346 "this->size() (which is %zu)"),
3347 __s, __pos, this->
size());
3352 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 3355 __throw_length_error(__N(__s));
3360 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
3362 const bool __testoff = __off < this->
size() - __pos;
3363 return __testoff ? __off : this->
size() - __pos;
3368 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
3370 return (less<const _CharT*>()(__s, _M_data())
3371 || less<const _CharT*>()(_M_data() + this->
size(), __s));
3377 _M_copy(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
3380 traits_type::assign(*__d, *__s);
3382 traits_type::copy(__d, __s, __n);
3386 _M_move(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
3389 traits_type::assign(*__d, *__s);
3391 traits_type::move(__d, __s, __n);
3395 _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
3398 traits_type::assign(*__d, __c);
3400 traits_type::assign(__d, __n, __c);
3405 template<
class _Iterator>
3407 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
3409 for (; __k1 != __k2; ++__k1, (void)++__p)
3410 traits_type::assign(*__p, *__k1);
3414 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
3415 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
3418 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
3420 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
3423 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
3424 { _M_copy(__p, __k1, __k2 - __k1); }
3427 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
3429 { _M_copy(__p, __k1, __k2 - __k1); }
3432 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
3434 const difference_type __d = difference_type(__n1 - __n2);
3436 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
3437 return __gnu_cxx::__numeric_traits<int>::__max;
3438 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
3439 return __gnu_cxx::__numeric_traits<int>::__min;
3445 _M_mutate(size_type __pos, size_type __len1, size_type __len2);
3451 _S_empty_rep() _GLIBCXX_NOEXCEPT
3452 {
return _Rep::_S_empty_rep(); }
3454 #if __cplusplus > 201402L 3456 typedef basic_string_view<_CharT, _Traits> __sv_type;
3458 template<
typename _Tp,
typename _Res>
3460 __and_<is_convertible<const _Tp&, __sv_type>,
3461 __not_<is_convertible<const _Tp*, const basic_string*>>,
3462 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
3467 _S_to_string_view(__sv_type __svt) noexcept
3476 explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
3490 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3491 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
3493 : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ }
3518 const _Alloc& __a = _Alloc());
3536 size_type __n,
const _Alloc& __a);
3548 const _Alloc& __a = _Alloc());
3554 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc());
3561 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc());
3563 #if __cplusplus >= 201103L 3572 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3575 : _M_dataplus(__str._M_dataplus)
3577 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3578 __str._M_data(_S_empty_rep()._M_refdata());
3580 __str._M_data(_S_construct(size_type(), _CharT(),
get_allocator()));
3598 template<
class _InputIterator>
3599 basic_string(_InputIterator __beg, _InputIterator __end,
3600 const _Alloc& __a = _Alloc());
3602 #if __cplusplus > 201402L 3610 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
3611 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
3612 const _Alloc& __a = _Alloc())
3620 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
3622 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
3623 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
3648 {
return this->
assign(__str); }
3656 {
return this->
assign(__s); }
3672 #if __cplusplus >= 201103L 3696 this->
assign(__l.begin(), __l.size());
3701 #if __cplusplus > 201402L 3706 template<
typename _Tp>
3707 _If_sv<_Tp, basic_string&>
3709 {
return this->
assign(__svt); }
3715 operator __sv_type() const noexcept
3716 {
return __sv_type(
data(),
size()); }
3728 return iterator(_M_data());
3737 {
return const_iterator(_M_data()); }
3747 return iterator(_M_data() + this->
size());
3756 {
return const_iterator(_M_data() + this->
size()); }
3772 const_reverse_iterator
3790 const_reverse_iterator
3794 #if __cplusplus >= 201103L 3801 {
return const_iterator(this->_M_data()); }
3809 {
return const_iterator(this->_M_data() + this->
size()); }
3816 const_reverse_iterator
3825 const_reverse_iterator
3836 {
return _M_rep()->_M_length; }
3842 {
return _M_rep()->_M_length; }
3847 {
return _Rep::_S_max_size; }
3860 resize(size_type __n, _CharT __c);
3874 { this->
resize(__n, _CharT()); }
3876 #if __cplusplus >= 201103L 3881 #if __cpp_exceptions 3899 {
return _M_rep()->_M_capacity; }
3919 reserve(size_type __res_arg = 0);
3924 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3928 if (_M_rep()->_M_is_shared())
3931 _M_data(_S_empty_rep()._M_refdata());
3934 _M_rep()->_M_set_length_and_sharable(0);
3940 { _M_mutate(0, this->
size(), 0); }
3949 {
return this->
size() == 0; }
3965 __glibcxx_assert(__pos <=
size());
3966 return _M_data()[__pos];
3984 __glibcxx_assert(__pos <=
size());
3986 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
3988 return _M_data()[__pos];
4004 if (__n >= this->
size())
4005 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 4006 "(which is %zu) >= this->size() " 4009 return _M_data()[__n];
4027 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 4028 "(which is %zu) >= this->size() " 4032 return _M_data()[__n];
4035 #if __cplusplus >= 201103L 4043 __glibcxx_assert(!
empty());
4054 __glibcxx_assert(!
empty());
4065 __glibcxx_assert(!
empty());
4076 __glibcxx_assert(!
empty());
4089 {
return this->
append(__str); }
4098 {
return this->
append(__s); }
4112 #if __cplusplus >= 201103L 4120 {
return this->
append(__l.begin(), __l.size()); }
4123 #if __cplusplus > 201402L 4129 template<
typename _Tp>
4130 _If_sv<_Tp, basic_string&>
4132 {
return this->
append(__svt); }
4166 append(
const _CharT* __s, size_type __n);
4176 __glibcxx_requires_string(__s);
4177 return this->
append(__s, traits_type::length(__s));
4189 append(size_type __n, _CharT __c);
4191 #if __cplusplus >= 201103L 4199 {
return this->
append(__l.begin(), __l.size()); }
4210 template<
class _InputIterator>
4212 append(_InputIterator __first, _InputIterator __last)
4213 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
4215 #if __cplusplus > 201402L 4221 template<
typename _Tp>
4222 _If_sv<_Tp, basic_string&>
4225 __sv_type __sv = __svt;
4226 return this->
append(__sv.data(), __sv.size());
4237 template<
typename _Tp>
4238 _If_sv<_Tp, basic_string&>
4239 append(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
4241 __sv_type __sv = __svt;
4242 return append(__sv.data()
4243 + __sv._M_check(__pos,
"basic_string::append"),
4244 __sv._M_limit(__pos, __n));
4255 const size_type __len = 1 + this->
size();
4256 if (__len > this->
capacity() || _M_rep()->_M_is_shared())
4258 traits_type::assign(_M_data()[this->
size()], __c);
4259 _M_rep()->_M_set_length_and_sharable(__len);
4270 #if __cplusplus >= 201103L 4303 {
return this->
assign(__str._M_data()
4304 + __str._M_check(__pos,
"basic_string::assign"),
4305 __str._M_limit(__pos, __n)); }
4318 assign(
const _CharT* __s, size_type __n);
4332 __glibcxx_requires_string(__s);
4333 return this->
assign(__s, traits_type::length(__s));
4347 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
4357 template<
class _InputIterator>
4359 assign(_InputIterator __first, _InputIterator __last)
4360 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
4362 #if __cplusplus >= 201103L 4370 {
return this->
assign(__l.begin(), __l.size()); }
4373 #if __cplusplus > 201402L 4379 template<
typename _Tp>
4380 _If_sv<_Tp, basic_string&>
4383 __sv_type __sv = __svt;
4384 return this->
assign(__sv.data(), __sv.size());
4394 template<
typename _Tp>
4395 _If_sv<_Tp, basic_string&>
4396 assign(
const _Tp& __svt, size_type __pos, size_type __n =
npos)
4398 __sv_type __sv = __svt;
4399 return assign(__sv.data()
4400 + __sv._M_check(__pos,
"basic_string::assign"),
4401 __sv._M_limit(__pos, __n));
4419 insert(iterator __p, size_type __n, _CharT __c)
4420 { this->
replace(__p, __p, __n, __c); }
4434 template<
class _InputIterator>
4436 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
4437 { this->
replace(__p, __p, __beg, __end); }
4439 #if __cplusplus >= 201103L 4449 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
4450 this->
insert(__p - _M_ibegin(), __l.begin(), __l.size());
4468 {
return this->
insert(__pos1, __str, size_type(0), __str.size()); }
4490 size_type __pos2, size_type __n =
npos)
4491 {
return this->
insert(__pos1, __str._M_data()
4492 + __str._M_check(__pos2,
"basic_string::insert"),
4493 __str._M_limit(__pos2, __n)); }
4512 insert(size_type __pos,
const _CharT* __s, size_type __n);
4532 __glibcxx_requires_string(__s);
4533 return this->
insert(__pos, __s, traits_type::length(__s));
4553 insert(size_type __pos, size_type __n, _CharT __c)
4554 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
4555 size_type(0), __n, __c); }
4573 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
4574 const size_type __pos = __p - _M_ibegin();
4575 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
4576 _M_rep()->_M_set_leaked();
4577 return iterator(_M_data() + __pos);
4580 #if __cplusplus > 201402L 4587 template<
typename _Tp>
4588 _If_sv<_Tp, basic_string&>
4589 insert(size_type __pos,
const _Tp& __svt)
4591 __sv_type __sv = __svt;
4592 return this->
insert(__pos, __sv.data(), __sv.size());
4604 template<
typename _Tp>
4605 _If_sv<_Tp, basic_string&>
4606 insert(size_type __pos1,
const _Tp& __svt,
4607 size_type __pos2, size_type __n =
npos)
4609 __sv_type __sv = __svt;
4610 return this->
replace(__pos1, size_type(0), __sv.data()
4611 + __sv._M_check(__pos2,
"basic_string::insert"),
4612 __sv._M_limit(__pos2, __n));
4634 _M_mutate(_M_check(__pos,
"basic_string::erase"),
4635 _M_limit(__pos, __n), size_type(0));
4650 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
4651 && __position < _M_iend());
4652 const size_type __pos = __position - _M_ibegin();
4653 _M_mutate(__pos, size_type(1), size_type(0));
4654 _M_rep()->_M_set_leaked();
4655 return iterator(_M_data() + __pos);
4670 #if __cplusplus >= 201103L 4679 __glibcxx_assert(!
empty());
4703 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
4725 size_type __pos2, size_type __n2 =
npos)
4726 {
return this->
replace(__pos1, __n1, __str._M_data()
4727 + __str._M_check(__pos2,
"basic_string::replace"),
4728 __str._M_limit(__pos2, __n2)); }
4749 replace(size_type __pos, size_type __n1,
const _CharT* __s,
4769 replace(size_type __pos, size_type __n1,
const _CharT* __s)
4771 __glibcxx_requires_string(__s);
4772 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
4793 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
4794 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
4795 _M_limit(__pos, __n1), __n2, __c); }
4812 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
4830 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
4832 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4833 && __i2 <= _M_iend());
4834 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
4851 replace(iterator __i1, iterator __i2,
const _CharT* __s)
4853 __glibcxx_requires_string(__s);
4854 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
4872 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
4874 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4875 && __i2 <= _M_iend());
4876 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
4894 template<
class _InputIterator>
4897 _InputIterator __k1, _InputIterator __k2)
4899 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4900 && __i2 <= _M_iend());
4901 __glibcxx_requires_valid_range(__k1, __k2);
4902 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
4903 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
4911 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4912 && __i2 <= _M_iend());
4913 __glibcxx_requires_valid_range(__k1, __k2);
4914 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4919 replace(iterator __i1, iterator __i2,
4920 const _CharT* __k1,
const _CharT* __k2)
4922 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4923 && __i2 <= _M_iend());
4924 __glibcxx_requires_valid_range(__k1, __k2);
4925 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4930 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
4932 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4933 && __i2 <= _M_iend());
4934 __glibcxx_requires_valid_range(__k1, __k2);
4935 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4936 __k1.base(), __k2 - __k1);
4940 replace(iterator __i1, iterator __i2,
4941 const_iterator __k1, const_iterator __k2)
4943 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4944 && __i2 <= _M_iend());
4945 __glibcxx_requires_valid_range(__k1, __k2);
4946 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4947 __k1.base(), __k2 - __k1);
4950 #if __cplusplus >= 201103L 4967 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
4970 #if __cplusplus > 201402L 4978 template<
typename _Tp>
4979 _If_sv<_Tp, basic_string&>
4980 replace(size_type __pos, size_type __n,
const _Tp& __svt)
4982 __sv_type __sv = __svt;
4983 return this->
replace(__pos, __n, __sv.data(), __sv.size());
4995 template<
typename _Tp>
4996 _If_sv<_Tp, basic_string&>
4997 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
4998 size_type __pos2, size_type __n2 =
npos)
5000 __sv_type __sv = __svt;
5001 return this->
replace(__pos1, __n1,
5002 __sv.data() + __sv._M_check(__pos2,
"basic_string::replace"),
5003 __sv._M_limit(__pos2, __n2));
5015 template<
typename _Tp>
5016 _If_sv<_Tp, basic_string&>
5017 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
5019 __sv_type __sv = __svt;
5020 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
5025 template<
class _Integer>
5027 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
5028 _Integer __val, __true_type)
5029 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
5031 template<
class _InputIterator>
5033 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
5034 _InputIterator __k2, __false_type);
5037 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
5041 _M_replace_safe(size_type __pos1, size_type __n1,
const _CharT* __s,
5046 template<
class _InIterator>
5048 _S_construct_aux(_InIterator __beg, _InIterator __end,
5049 const _Alloc& __a, __false_type)
5051 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
5052 return _S_construct(__beg, __end, __a, _Tag());
5057 template<
class _Integer>
5059 _S_construct_aux(_Integer __beg, _Integer __end,
5060 const _Alloc& __a, __true_type)
5061 {
return _S_construct_aux_2(static_cast<size_type>(__beg),
5065 _S_construct_aux_2(size_type __req, _CharT __c,
const _Alloc& __a)
5066 {
return _S_construct(__req, __c, __a); }
5068 template<
class _InIterator>
5070 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a)
5072 typedef typename std::__is_integer<_InIterator>::__type _Integral;
5073 return _S_construct_aux(__beg, __end, __a, _Integral());
5077 template<
class _InIterator>
5079 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
5080 input_iterator_tag);
5084 template<
class _FwdIterator>
5086 _S_construct(_FwdIterator __beg, _FwdIterator __end,
const _Alloc& __a,
5087 forward_iterator_tag);
5090 _S_construct(size_type __req, _CharT __c,
const _Alloc& __a);
5107 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
5129 {
return _M_data(); }
5141 {
return _M_data(); }
5143 #if __cplusplus > 201402L 5163 {
return _M_dataplus; }
5178 find(
const _CharT* __s, size_type __pos, size_type __n)
const 5194 {
return this->
find(__str.data(), __pos, __str.size()); }
5207 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
5209 __glibcxx_requires_string(__s);
5210 return this->
find(__s, __pos, traits_type::length(__s));
5224 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
5226 #if __cplusplus > 201402L 5233 template<
typename _Tp>
5234 _If_sv<_Tp, size_type>
5235 find(
const _Tp& __svt, size_type __pos = 0) const
5236 noexcept(
is_same<_Tp, __sv_type>::value)
5238 __sv_type __sv = __svt;
5239 return this->
find(__sv.data(), __pos, __sv.size());
5256 {
return this->
rfind(__str.data(), __pos, __str.size()); }
5271 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const 5285 rfind(
const _CharT* __s, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT
5287 __glibcxx_requires_string(__s);
5288 return this->
rfind(__s, __pos, traits_type::length(__s));
5302 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
5304 #if __cplusplus > 201402L 5311 template<
typename _Tp>
5312 _If_sv<_Tp, size_type>
5313 rfind(
const _Tp& __svt, size_type __pos =
npos)
const 5316 __sv_type __sv = __svt;
5317 return this->
rfind(__sv.data(), __pos, __sv.size());
5335 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
5350 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const 5367 __glibcxx_requires_string(__s);
5368 return this->
find_first_of(__s, __pos, traits_type::length(__s));
5385 {
return this->
find(__c, __pos); }
5387 #if __cplusplus > 201402L 5395 template<
typename _Tp>
5396 _If_sv<_Tp, size_type>
5398 noexcept(
is_same<_Tp, __sv_type>::value)
5400 __sv_type __sv = __svt;
5401 return this->
find_first_of(__sv.data(), __pos, __sv.size());
5419 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
5434 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const 5451 __glibcxx_requires_string(__s);
5452 return this->
find_last_of(__s, __pos, traits_type::length(__s));
5469 {
return this->
rfind(__c, __pos); }
5471 #if __cplusplus > 201402L 5479 template<
typename _Tp>
5480 _If_sv<_Tp, size_type>
5484 __sv_type __sv = __svt;
5485 return this->
find_last_of(__sv.data(), __pos, __sv.size());
5518 size_type __n)
const _GLIBCXX_NOEXCEPT;
5534 __glibcxx_requires_string(__s);
5552 #if __cplusplus > 201402L 5560 template<
typename _Tp>
5561 _If_sv<_Tp, size_type>
5563 noexcept(
is_same<_Tp, __sv_type>::value)
5565 __sv_type __sv = __svt;
5600 size_type __n)
const _GLIBCXX_NOEXCEPT;
5616 __glibcxx_requires_string(__s);
5634 #if __cplusplus > 201402L 5642 template<
typename _Tp>
5643 _If_sv<_Tp, size_type>
5647 __sv_type __sv = __svt;
5667 _M_check(__pos,
"basic_string::substr"), __n); }
5686 const size_type __size = this->
size();
5687 const size_type __osize = __str.size();
5688 const size_type __len =
std::min(__size, __osize);
5690 int __r = traits_type::compare(_M_data(), __str.data(), __len);
5692 __r = _S_compare(__size, __osize);
5696 #if __cplusplus > 201402L 5702 template<
typename _Tp>
5704 compare(
const _Tp& __svt)
const 5707 __sv_type __sv = __svt;
5708 const size_type __size = this->
size();
5709 const size_type __osize = __sv.size();
5710 const size_type __len =
std::min(__size, __osize);
5712 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
5714 __r = _S_compare(__size, __osize);
5726 template<
typename _Tp>
5728 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const 5729 noexcept(is_same<_Tp, __sv_type>::value)
5731 __sv_type __sv = __svt;
5732 return __sv_type(*this).substr(__pos, __n).compare(__sv);
5745 template<
typename _Tp>
5747 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
5748 size_type __pos2, size_type __n2 =
npos)
const 5749 noexcept(is_same<_Tp, __sv_type>::value)
5751 __sv_type __sv = __svt;
5752 return __sv_type(*
this)
5753 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
5804 size_type __pos2, size_type __n2 =
npos)
const;
5821 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
5845 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
5872 compare(size_type __pos, size_type __n1,
const _CharT* __s,
5873 size_type __n2)
const;
5875 # ifdef _GLIBCXX_TM_TS_INTERNAL 5877 ::_txnal_cow_string_C1_for_exceptions(
void* that,
const char* s,
5880 ::_txnal_cow_string_c_str(
const void *that);
5882 ::_txnal_cow_string_D1(
void *that);
5884 ::_txnal_cow_string_D1_commit(
void *that);
5887 #endif // !_GLIBCXX_USE_CXX11_ABI 5889 #if __cpp_deduction_guides >= 201606 5890 _GLIBCXX_BEGIN_NAMESPACE_CXX11
5891 template<
typename _InputIterator,
typename _CharT
5892 =
typename iterator_traits<_InputIterator>::value_type,
5893 typename _Allocator = allocator<_CharT>,
5894 typename = _RequireInputIter<_InputIterator>,
5895 typename = _RequireAllocator<_Allocator>>
5896 basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
5897 -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
5901 template<
typename _CharT,
typename _Traits,
5902 typename _Allocator = allocator<_CharT>,
5903 typename = _RequireAllocator<_Allocator>>
5904 basic_string(basic_string_view<_CharT, _Traits>,
const _Allocator& = _Allocator())
5905 -> basic_string<_CharT, _Traits, _Allocator>;
5907 template<
typename _CharT,
typename _Traits,
5908 typename _Allocator = allocator<_CharT>,
5909 typename = _RequireAllocator<_Allocator>>
5910 basic_string(basic_string_view<_CharT, _Traits>,
5911 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
5912 typename basic_string<_CharT, _Traits, _Allocator>::size_type,
5913 const _Allocator& = _Allocator())
5914 -> basic_string<_CharT, _Traits, _Allocator>;
5915 _GLIBCXX_END_NAMESPACE_CXX11
5925 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5926 basic_string<_CharT, _Traits, _Alloc>
5931 __str.append(__rhs);
5941 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5942 basic_string<_CharT,_Traits,_Alloc>
5944 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
5952 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5953 basic_string<_CharT,_Traits,_Alloc>
5954 operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
5962 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5963 inline basic_string<_CharT, _Traits, _Alloc>
5965 const _CharT* __rhs)
5968 __str.append(__rhs);
5978 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5979 inline basic_string<_CharT, _Traits, _Alloc>
5983 typedef typename __string_type::size_type __size_type;
5984 __string_type __str(__lhs);
5985 __str.append(__size_type(1), __rhs);
5989 #if __cplusplus >= 201103L 5990 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5991 inline basic_string<_CharT, _Traits, _Alloc>
5992 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
5993 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
5994 {
return std::move(__lhs.append(__rhs)); }
5996 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5997 inline basic_string<_CharT, _Traits, _Alloc>
5998 operator+(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
5999 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
6000 {
return std::move(__rhs.insert(0, __lhs)); }
6002 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6003 inline basic_string<_CharT, _Traits, _Alloc>
6004 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
6005 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
6007 const auto __size = __lhs.size() + __rhs.size();
6008 const bool __cond = (__size > __lhs.capacity()
6009 && __size <= __rhs.capacity());
6010 return __cond ? std::move(__rhs.insert(0, __lhs))
6011 : std::move(__lhs.append(__rhs));
6014 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6015 inline basic_string<_CharT, _Traits, _Alloc>
6017 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
6018 {
return std::move(__rhs.insert(0, __lhs)); }
6020 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6021 inline basic_string<_CharT, _Traits, _Alloc>
6023 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
6024 {
return std::move(__rhs.insert(0, 1, __lhs)); }
6026 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6027 inline basic_string<_CharT, _Traits, _Alloc>
6028 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
6029 const _CharT* __rhs)
6030 {
return std::move(__lhs.append(__rhs)); }
6032 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6033 inline basic_string<_CharT, _Traits, _Alloc>
6034 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
6036 {
return std::move(__lhs.append(1, __rhs)); }
6046 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6051 {
return __lhs.compare(__rhs) == 0; }
6053 template<
typename _CharT>
6055 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
6056 operator==(
const basic_string<_CharT>& __lhs,
6057 const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT
6058 {
return (__lhs.size() == __rhs.size()
6068 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6070 operator==(
const _CharT* __lhs,
6072 {
return __rhs.compare(__lhs) == 0; }
6080 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6083 const _CharT* __rhs)
6084 {
return __lhs.compare(__rhs) == 0; }
6093 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6098 {
return !(__lhs == __rhs); }
6106 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6108 operator!=(
const _CharT* __lhs,
6110 {
return !(__lhs == __rhs); }
6118 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6121 const _CharT* __rhs)
6122 {
return !(__lhs == __rhs); }
6131 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6136 {
return __lhs.compare(__rhs) < 0; }
6144 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6147 const _CharT* __rhs)
6148 {
return __lhs.compare(__rhs) < 0; }
6156 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6158 operator<(
const _CharT* __lhs,
6160 {
return __rhs.compare(__lhs) > 0; }
6169 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6174 {
return __lhs.compare(__rhs) > 0; }
6182 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6185 const _CharT* __rhs)
6186 {
return __lhs.compare(__rhs) > 0; }
6194 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6196 operator>(
const _CharT* __lhs,
6198 {
return __rhs.compare(__lhs) < 0; }
6207 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6212 {
return __lhs.compare(__rhs) <= 0; }
6220 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6223 const _CharT* __rhs)
6224 {
return __lhs.compare(__rhs) <= 0; }
6232 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6234 operator<=(
const _CharT* __lhs,
6236 {
return __rhs.compare(__lhs) >= 0; }
6245 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6250 {
return __lhs.compare(__rhs) >= 0; }
6258 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6261 const _CharT* __rhs)
6262 {
return __lhs.compare(__rhs) >= 0; }
6270 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6272 operator>=(
const _CharT* __lhs,
6274 {
return __rhs.compare(__lhs) <= 0; }
6283 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6287 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
6288 { __lhs.swap(__rhs); }
6303 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6304 basic_istream<_CharT, _Traits>&
6305 operator>>(basic_istream<_CharT, _Traits>& __is,
6306 basic_string<_CharT, _Traits, _Alloc>& __str);
6309 basic_istream<char>&
6310 operator>>(basic_istream<char>& __is, basic_string<char>& __str);
6321 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6322 inline basic_ostream<_CharT, _Traits>&
6328 return __ostream_insert(__os, __str.data(), __str.size());
6344 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6345 basic_istream<_CharT, _Traits>&
6346 getline(basic_istream<_CharT, _Traits>& __is,
6347 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
6361 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6362 inline basic_istream<_CharT, _Traits>&
6367 #if __cplusplus >= 201103L 6369 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6370 inline basic_istream<_CharT, _Traits>&
6376 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6377 inline basic_istream<_CharT, _Traits>&
6384 basic_istream<char>&
6385 getline(basic_istream<char>& __in, basic_string<char>& __str,
6388 #ifdef _GLIBCXX_USE_WCHAR_T 6390 basic_istream<wchar_t>&
6391 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
6395 _GLIBCXX_END_NAMESPACE_VERSION
6398 #if __cplusplus >= 201103L 6402 namespace std _GLIBCXX_VISIBILITY(default)
6404 _GLIBCXX_BEGIN_NAMESPACE_VERSION
6405 _GLIBCXX_BEGIN_NAMESPACE_CXX11
6407 #if _GLIBCXX_USE_C99_STDLIB 6410 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6411 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
6415 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6416 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
6419 inline unsigned long 6420 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6421 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
6425 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6426 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
6429 inline unsigned long long 6430 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6431 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
6436 stof(
const string& __str,
size_t* __idx = 0)
6437 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
6440 stod(
const string& __str,
size_t* __idx = 0)
6441 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
6444 stold(
const string& __str,
size_t* __idx = 0)
6445 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
6446 #endif // _GLIBCXX_USE_C99_STDLIB 6448 #if _GLIBCXX_USE_C99_STDIO 6453 to_string(
int __val)
6454 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(
int),
6458 to_string(
unsigned __val)
6459 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6460 4 *
sizeof(
unsigned),
6464 to_string(
long __val)
6465 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(
long),
6469 to_string(
unsigned long __val)
6470 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6471 4 *
sizeof(
unsigned long),
6475 to_string(
long long __val)
6476 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6477 4 *
sizeof(
long long),
6481 to_string(
unsigned long long __val)
6482 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6483 4 *
sizeof(
unsigned long long),
6487 to_string(
float __val)
6490 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
6491 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6496 to_string(
double __val)
6499 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
6500 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6505 to_string(
long double __val)
6508 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
6509 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6512 #endif // _GLIBCXX_USE_C99_STDIO 6514 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR 6516 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6517 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
6521 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6522 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
6525 inline unsigned long 6526 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6527 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
6531 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6532 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
6535 inline unsigned long long 6536 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6537 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
6542 stof(
const wstring& __str,
size_t* __idx = 0)
6543 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
6546 stod(
const wstring& __str,
size_t* __idx = 0)
6547 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
6550 stold(
const wstring& __str,
size_t* __idx = 0)
6551 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
6553 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 6556 to_wstring(
int __val)
6557 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
int),
6561 to_wstring(
unsigned __val)
6562 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6563 4 *
sizeof(
unsigned),
6567 to_wstring(
long __val)
6568 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(
long),
6572 to_wstring(
unsigned long __val)
6573 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6574 4 *
sizeof(
unsigned long),
6578 to_wstring(
long long __val)
6579 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6580 4 *
sizeof(
long long),
6584 to_wstring(
unsigned long long __val)
6585 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6586 4 *
sizeof(
unsigned long long),
6590 to_wstring(
float __val)
6593 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
6594 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6599 to_wstring(
double __val)
6602 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
6603 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6608 to_wstring(
long double __val)
6611 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
6612 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6615 #endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF 6616 #endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR 6618 _GLIBCXX_END_NAMESPACE_CXX11
6619 _GLIBCXX_END_NAMESPACE_VERSION
6624 #if __cplusplus >= 201103L 6628 namespace std _GLIBCXX_VISIBILITY(default)
6630 _GLIBCXX_BEGIN_NAMESPACE_VERSION
6634 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X 6638 :
public __hash_base<size_t, string>
6641 operator()(
const string& __s)
const noexcept
6642 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
6649 #ifdef _GLIBCXX_USE_WCHAR_T 6653 :
public __hash_base<size_t, wstring>
6656 operator()(
const wstring& __s)
const noexcept
6657 {
return std::_Hash_impl::hash(__s.
data(),
6658 __s.
length() *
sizeof(wchar_t)); }
6667 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 6671 :
public __hash_base<size_t, u16string>
6674 operator()(
const u16string& __s)
const noexcept
6675 {
return std::_Hash_impl::hash(__s.
data(),
6676 __s.
length() *
sizeof(char16_t)); }
6686 :
public __hash_base<size_t, u32string>
6689 operator()(
const u32string& __s)
const noexcept
6690 {
return std::_Hash_impl::hash(__s.
data(),
6691 __s.
length() *
sizeof(char32_t)); }
6699 #if __cplusplus > 201103L 6701 #define __cpp_lib_string_udls 201304 6703 inline namespace literals
6705 inline namespace string_literals
6707 #pragma GCC diagnostic push 6708 #pragma GCC diagnostic ignored "-Wliteral-suffix" 6709 _GLIBCXX_DEFAULT_ABI_TAG
6710 inline basic_string<char>
6711 operator""s(
const char* __str,
size_t __len)
6712 {
return basic_string<char>{__str, __len}; }
6714 #ifdef _GLIBCXX_USE_WCHAR_T 6715 _GLIBCXX_DEFAULT_ABI_TAG
6716 inline basic_string<wchar_t>
6717 operator""s(
const wchar_t* __str,
size_t __len)
6718 {
return basic_string<wchar_t>{__str, __len}; }
6721 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 6722 _GLIBCXX_DEFAULT_ABI_TAG
6723 inline basic_string<char16_t>
6724 operator""s(
const char16_t* __str,
size_t __len)
6725 {
return basic_string<char16_t>{__str, __len}; }
6727 _GLIBCXX_DEFAULT_ABI_TAG
6728 inline basic_string<char32_t>
6729 operator""s(
const char32_t* __str,
size_t __len)
6730 {
return basic_string<char32_t>{__str, __len}; }
6733 #pragma GCC diagnostic pop 6737 #endif // __cplusplus > 201103L 6739 _GLIBCXX_END_NAMESPACE_VERSION
const_iterator cend() const noexcept
basic_string & operator+=(const _CharT *__s)
Append a C string.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
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.
basic_string(basic_string &&__str) noexcept
Move construct string.
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
const_reverse_iterator crbegin() const noexcept
basic_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
size_type capacity() const noexcept
~basic_string() noexcept
Destroy the string instance.
Managing sequences of characters and character-like objects.
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.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
basic_string & operator+=(initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type find(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a C string.
basic_string & assign(basic_string &&__str)
Set value to contents of another 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.
reference at(size_type __n)
Provides access to the data contained in the string.
basic_string & assign(const _CharT *__s)
Set value to contents of a C string.
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
basic_string & replace(iterator __i1, iterator __i2, initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
Forward iterators support a superset of input iterator operations.
const_reverse_iterator rbegin() const noexcept
basic_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
Primary class template hash.
const_reference back() const noexcept
const_reference at(size_type __n) const
Provides access to the data contained in the string.
basic_string()
Default constructor creates an empty string.
basic_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
const_reference front() const noexcept
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a character of C string.
basic_string & assign(initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
basic_string & operator=(_CharT __c)
Set value to string of length 1.
void insert(iterator __p, initializer_list< _CharT > __l)
Insert an initializer_list of characters.
basic_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
char_type widen(char __c) const
Widens characters.
reverse_iterator rbegin()
iterator insert(iterator __p, _CharT __c)
Insert one character.
Template class basic_istream.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
basic_string< wchar_t > wstring
A string of wchar_t.
void resize(size_type __n)
Resizes the string to the specified number of characters.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
void pop_back()
Remove the last character.
void push_back(_CharT __c)
Append a single character.
basic_string & append(initializer_list< _CharT > __l)
Append an initializer_list of characters.
basic_string & operator+=(const basic_string &__str)
Append a string to this string.
basic_string & insert(size_type __pos1, const basic_string &__str)
Insert value of a string.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
basic_string & assign(const basic_string &__str, size_type __pos, size_type __n=npos)
Set value to a substring of a string.
iterator erase(iterator __position)
Remove one character.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
ISO C++ entities toplevel namespace is std.
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
int compare(const basic_string &__str) const
Compare to a string.
basic_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
basic_string & replace(iterator __i1, iterator __i2, const basic_string &__str)
Replace range of characters with string.
Basis for explicit traits specializations.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
Template class basic_ostream.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
basic_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
basic_string & operator=(basic_string &&__str)
Move assign the value of str to this string.
static const size_type npos
Value returned by various member functions when they fail.
basic_string & operator=(initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
basic_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a character not in C string.
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
const_reverse_iterator crend() const noexcept
basic_string & append(const _CharT *__s)
Append a C string.
basic_string & append(const basic_string &__str)
Append a string to this string.
basic_string & insert(size_type __pos1, const basic_string &__str, size_type __pos2, size_type __n=npos)
Insert a substring.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
basic_string & operator+=(_CharT __c)
Append a character.
Uniform interface to all pointer-like types.
size_type find(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a string.
basic_string & operator=(const _CharT *__s)
Copy contents of s into this string.
Uniform interface to C++98 and C++11 allocators.
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
const_iterator end() const noexcept
const_reverse_iterator rend() const noexcept
basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a character of C string.
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.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
const _CharT * data() const noexcept
Return const pointer to contents.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
const_iterator cbegin() const noexcept
size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
void swap(basic_string &__s)
Swap contents with another string.
basic_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
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.
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 rfind(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a C string.
bool empty() const noexcept
const_iterator begin() const noexcept
basic_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.