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>
116 using _If_sv = enable_if_t<
117 __and_<is_convertible<const _Tp&, __sv_type>,
118 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
123 _S_to_string_view(__sv_type __svt) noexcept
132 explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
138 struct _Alloc_hider : allocator_type
140 #if __cplusplus < 201103L 141 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
142 : allocator_type(__a), _M_p(__dat) { }
144 _Alloc_hider(pointer __dat,
const _Alloc& __a)
145 : allocator_type(__a), _M_p(__dat) { }
147 _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc())
148 : allocator_type(
std::move(__a)), _M_p(__dat) { }
154 _Alloc_hider _M_dataplus;
155 size_type _M_string_length;
157 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
161 _CharT _M_local_buf[_S_local_capacity + 1];
162 size_type _M_allocated_capacity;
167 { _M_dataplus._M_p = __p; }
170 _M_length(size_type __length)
171 { _M_string_length = __length; }
175 {
return _M_dataplus._M_p; }
180 #if __cplusplus >= 201103L 183 return pointer(_M_local_buf);
188 _M_local_data()
const 190 #if __cplusplus >= 201103L 193 return const_pointer(_M_local_buf);
198 _M_capacity(size_type __capacity)
199 { _M_allocated_capacity = __capacity; }
202 _M_set_length(size_type __n)
205 traits_type::assign(_M_data()[__n], _CharT());
210 {
return _M_data() == _M_local_data(); }
214 _M_create(size_type&, size_type);
220 _M_destroy(_M_allocated_capacity);
224 _M_destroy(size_type __size)
throw()
225 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
229 template<
typename _InIterator>
231 _M_construct_aux(_InIterator __beg, _InIterator __end,
234 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
235 _M_construct(__beg, __end, _Tag());
240 template<
typename _Integer>
242 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
243 { _M_construct_aux_2(static_cast<size_type>(__beg), __end); }
246 _M_construct_aux_2(size_type __req, _CharT __c)
247 { _M_construct(__req, __c); }
249 template<
typename _InIterator>
251 _M_construct(_InIterator __beg, _InIterator __end)
253 typedef typename std::__is_integer<_InIterator>::__type _Integral;
254 _M_construct_aux(__beg, __end, _Integral());
258 template<
typename _InIterator>
260 _M_construct(_InIterator __beg, _InIterator __end,
265 template<
typename _FwdIterator>
267 _M_construct(_FwdIterator __beg, _FwdIterator __end,
271 _M_construct(size_type __req, _CharT __c);
275 {
return _M_dataplus; }
277 const allocator_type&
278 _M_get_allocator()
const 279 {
return _M_dataplus; }
283 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 286 template<
typename _Tp,
bool _Requires =
287 !__are_same<_Tp, _CharT*>::__value
288 && !__are_same<_Tp, const _CharT*>::__value
289 && !__are_same<_Tp, iterator>::__value
290 && !__are_same<_Tp, const_iterator>::__value>
291 struct __enable_if_not_native_iterator
293 template<
typename _Tp>
294 struct __enable_if_not_native_iterator<_Tp, false> { };
298 _M_check(size_type __pos,
const char* __s)
const 300 if (__pos > this->
size())
301 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 302 "this->size() (which is %zu)"),
303 __s, __pos, this->
size());
308 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 311 __throw_length_error(__N(__s));
317 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
319 const bool __testoff = __off < this->
size() - __pos;
320 return __testoff ? __off : this->
size() - __pos;
325 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
327 return (less<const _CharT*>()(__s, _M_data())
328 || less<const _CharT*>()(_M_data() + this->
size(), __s));
334 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
337 traits_type::assign(*__d, *__s);
339 traits_type::copy(__d, __s, __n);
343 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
346 traits_type::assign(*__d, *__s);
348 traits_type::move(__d, __s, __n);
352 _S_assign(_CharT* __d, size_type __n, _CharT __c)
355 traits_type::assign(*__d, __c);
357 traits_type::assign(__d, __n, __c);
362 template<
class _Iterator>
364 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
366 for (; __k1 != __k2; ++__k1, (void)++__p)
367 traits_type::assign(*__p, *__k1);
371 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
372 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
375 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
377 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
380 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
381 { _S_copy(__p, __k1, __k2 - __k1); }
384 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
386 { _S_copy(__p, __k1, __k2 - __k1); }
389 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
391 const difference_type __d = difference_type(__n1 - __n2);
393 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
394 return __gnu_cxx::__numeric_traits<int>::__max;
395 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
396 return __gnu_cxx::__numeric_traits<int>::__min;
405 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
409 _M_erase(size_type __pos, size_type __n);
420 _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value)
421 : _M_dataplus(_M_local_data())
422 { _M_set_length(0); }
429 : _M_dataplus(_M_local_data(), __a)
430 { _M_set_length(0); }
437 : _M_dataplus(_M_local_data(),
438 _Alloc_traits::_S_select_on_copy(__str._M_get_allocator()))
439 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
450 const _Alloc& __a = _Alloc())
451 : _M_dataplus(_M_local_data(), __a)
453 const _CharT* __start = __str._M_data()
454 + __str._M_check(__pos,
"basic_string::basic_string");
455 _M_construct(__start, __start + __str._M_limit(__pos, npos));
464 basic_string(
const basic_string& __str, size_type __pos,
466 : _M_dataplus(_M_local_data())
468 const _CharT* __start = __str._M_data()
469 + __str._M_check(__pos,
"basic_string::basic_string");
470 _M_construct(__start, __start + __str._M_limit(__pos, __n));
480 basic_string(
const basic_string& __str, size_type __pos,
481 size_type __n,
const _Alloc& __a)
482 : _M_dataplus(_M_local_data(), __a)
484 const _CharT* __start
485 = __str._M_data() + __str._M_check(__pos,
"string::string");
486 _M_construct(__start, __start + __str._M_limit(__pos, __n));
499 const _Alloc& __a = _Alloc())
500 : _M_dataplus(_M_local_data(), __a)
501 { _M_construct(__s, __s + __n); }
508 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc())
509 : _M_dataplus(_M_local_data(), __a)
510 { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+npos); }
518 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc())
519 : _M_dataplus(_M_local_data(), __a)
520 { _M_construct(__n, __c); }
522 #if __cplusplus >= 201103L 531 : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator()))
533 if (__str._M_is_local())
535 traits_type::copy(_M_local_buf, __str._M_local_buf,
536 _S_local_capacity + 1);
540 _M_data(__str._M_data());
541 _M_capacity(__str._M_allocated_capacity);
547 _M_length(__str.length());
548 __str._M_data(__str._M_local_data());
549 __str._M_set_length(0);
557 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
558 : _M_dataplus(_M_local_data(), __a)
559 { _M_construct(__l.begin(), __l.end()); }
561 basic_string(
const basic_string& __str,
const _Alloc& __a)
562 : _M_dataplus(_M_local_data(), __a)
563 { _M_construct(__str.begin(), __str.end()); }
566 noexcept(_Alloc_traits::_S_always_equal())
567 : _M_dataplus(_M_local_data(), __a)
569 if (__str._M_is_local())
571 traits_type::copy(_M_local_buf, __str._M_local_buf,
572 _S_local_capacity + 1);
573 _M_length(__str.length());
574 __str._M_set_length(0);
576 else if (_Alloc_traits::_S_always_equal()
577 || __str.get_allocator() == __a)
579 _M_data(__str._M_data());
580 _M_length(__str.length());
581 _M_capacity(__str._M_allocated_capacity);
582 __str._M_data(__str._M_local_buf);
583 __str._M_set_length(0);
586 _M_construct(__str.begin(), __str.end());
597 #if __cplusplus >= 201103L 598 template<
typename _InputIterator,
599 typename = std::_RequireInputIter<_InputIterator>>
601 template<
typename _InputIterator>
603 basic_string(_InputIterator __beg, _InputIterator __end,
604 const _Alloc& __a = _Alloc())
605 : _M_dataplus(_M_local_data(), __a)
606 { _M_construct(__beg, __end); }
608 #if __cplusplus > 201402L 616 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
617 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
618 const _Alloc& __a = _Alloc())
619 : basic_string(_S_to_string_view(__t).
substr(__pos, __n), __a) { }
626 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
628 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
629 : basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
639 : basic_string(__svw._M_sv.
data(), __svw._M_sv.
size(), __a) { }
655 #if __cplusplus >= 201103L 656 if (_Alloc_traits::_S_propagate_on_copy_assign())
658 if (!_Alloc_traits::_S_always_equal() && !_M_is_local()
659 && _M_get_allocator() != __str._M_get_allocator())
663 if (__str.size() <= _S_local_capacity)
665 _M_destroy(_M_allocated_capacity);
666 _M_data(_M_local_data());
671 const auto __len = __str.size();
672 auto __alloc = __str._M_get_allocator();
674 auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1);
675 _M_destroy(_M_allocated_capacity);
678 _M_set_length(__len);
681 std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator());
684 return this->
assign(__str);
693 {
return this->
assign(__s); }
709 #if __cplusplus >= 201103L 722 noexcept(_Alloc_traits::_S_nothrow_move())
724 if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign()
725 && !_Alloc_traits::_S_always_equal()
726 && _M_get_allocator() != __str._M_get_allocator())
729 _M_destroy(_M_allocated_capacity);
730 _M_data(_M_local_data());
734 std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator());
736 if (!__str._M_is_local()
737 && (_Alloc_traits::_S_propagate_on_move_assign()
738 || _Alloc_traits::_S_always_equal()))
740 pointer __data =
nullptr;
741 size_type __capacity;
744 if (_Alloc_traits::_S_always_equal())
747 __capacity = _M_allocated_capacity;
750 _M_destroy(_M_allocated_capacity);
753 _M_data(__str._M_data());
754 _M_length(__str.length());
755 _M_capacity(__str._M_allocated_capacity);
758 __str._M_data(__data);
759 __str._M_capacity(__capacity);
762 __str._M_data(__str._M_local_buf);
777 this->
assign(__l.begin(), __l.size());
782 #if __cplusplus > 201402L 787 template<
typename _Tp>
788 _If_sv<_Tp, basic_string&>
790 {
return this->
assign(__svt); }
796 operator __sv_type() const noexcept
797 {
return __sv_type(
data(),
size()); }
806 begin() _GLIBCXX_NOEXCEPT
807 {
return iterator(_M_data()); }
814 begin() const _GLIBCXX_NOEXCEPT
815 {
return const_iterator(_M_data()); }
822 end() _GLIBCXX_NOEXCEPT
823 {
return iterator(_M_data() + this->
size()); }
830 end() const _GLIBCXX_NOEXCEPT
831 {
return const_iterator(_M_data() + this->
size()); }
839 rbegin() _GLIBCXX_NOEXCEPT
840 {
return reverse_iterator(this->
end()); }
847 const_reverse_iterator
848 rbegin() const _GLIBCXX_NOEXCEPT
849 {
return const_reverse_iterator(this->
end()); }
857 rend() _GLIBCXX_NOEXCEPT
858 {
return reverse_iterator(this->
begin()); }
865 const_reverse_iterator
866 rend() const _GLIBCXX_NOEXCEPT
867 {
return const_reverse_iterator(this->
begin()); }
869 #if __cplusplus >= 201103L 876 {
return const_iterator(this->_M_data()); }
883 cend() const noexcept
884 {
return const_iterator(this->_M_data() + this->
size()); }
891 const_reverse_iterator
893 {
return const_reverse_iterator(this->
end()); }
900 const_reverse_iterator
901 crend() const noexcept
902 {
return const_reverse_iterator(this->
begin()); }
910 size() const _GLIBCXX_NOEXCEPT
911 {
return _M_string_length; }
916 length() const _GLIBCXX_NOEXCEPT
917 {
return _M_string_length; }
922 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
935 resize(size_type __n, _CharT __c);
949 { this->
resize(__n, _CharT()); }
951 #if __cplusplus >= 201103L 975 return _M_is_local() ? size_type(_S_local_capacity)
976 : _M_allocated_capacity;
997 reserve(size_type __res_arg = 0);
1003 clear() _GLIBCXX_NOEXCEPT
1004 { _M_set_length(0); }
1011 empty() const _GLIBCXX_NOEXCEPT
1012 {
return this->
size() == 0; }
1026 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
1028 __glibcxx_assert(__pos <=
size());
1029 return _M_data()[__pos];
1047 __glibcxx_assert(__pos <=
size());
1049 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
1050 return _M_data()[__pos];
1064 at(size_type __n)
const 1066 if (__n >= this->
size())
1067 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 1068 "(which is %zu) >= this->size() " 1071 return _M_data()[__n];
1088 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 1089 "(which is %zu) >= this->size() " 1092 return _M_data()[__n];
1095 #if __cplusplus >= 201103L 1103 __glibcxx_assert(!
empty());
1112 front() const noexcept
1114 __glibcxx_assert(!
empty());
1125 __glibcxx_assert(!
empty());
1134 back() const noexcept
1136 __glibcxx_assert(!
empty());
1149 {
return this->
append(__str); }
1158 {
return this->
append(__s); }
1172 #if __cplusplus >= 201103L 1180 {
return this->
append(__l.begin(), __l.size()); }
1183 #if __cplusplus > 201402L 1189 template<
typename _Tp>
1190 _If_sv<_Tp, basic_string&>
1192 {
return this->
append(__svt); }
1201 append(
const basic_string& __str)
1202 {
return _M_append(__str._M_data(), __str.size()); }
1218 append(
const basic_string& __str, size_type __pos, size_type __n)
1219 {
return _M_append(__str._M_data()
1220 + __str._M_check(__pos,
"basic_string::append"),
1221 __str._M_limit(__pos, __n)); }
1230 append(
const _CharT* __s, size_type __n)
1232 __glibcxx_requires_string_len(__s, __n);
1233 _M_check_length(size_type(0), __n,
"basic_string::append");
1234 return _M_append(__s, __n);
1243 append(
const _CharT* __s)
1245 __glibcxx_requires_string(__s);
1246 const size_type __n = traits_type::length(__s);
1247 _M_check_length(size_type(0), __n,
"basic_string::append");
1248 return _M_append(__s, __n);
1260 append(size_type __n, _CharT __c)
1261 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1263 #if __cplusplus >= 201103L 1270 append(initializer_list<_CharT> __l)
1271 {
return this->
append(__l.begin(), __l.size()); }
1282 #if __cplusplus >= 201103L 1283 template<
class _InputIterator,
1284 typename = std::_RequireInputIter<_InputIterator>>
1286 template<
class _InputIterator>
1289 append(_InputIterator __first, _InputIterator __last)
1292 #if __cplusplus > 201402L 1298 template<
typename _Tp>
1299 _If_sv<_Tp, basic_string&>
1302 __sv_type __sv = __svt;
1303 return this->
append(__sv.data(), __sv.size());
1313 template<
typename _Tp>
1314 _If_sv<_Tp, basic_string&>
1315 append(
const _Tp& __svt, size_type __pos, size_type __n = npos)
1317 __sv_type __sv = __svt;
1318 return _M_append(__sv.data()
1319 + __sv._M_check(__pos,
"basic_string::append"),
1320 __sv._M_limit(__pos, __n));
1331 const size_type __size = this->
size();
1333 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1334 traits_type::assign(this->_M_data()[__size], __c);
1335 this->_M_set_length(__size + 1);
1344 assign(
const basic_string& __str)
1346 this->_M_assign(__str);
1350 #if __cplusplus >= 201103L 1360 assign(basic_string&& __str)
1361 noexcept(_Alloc_traits::_S_nothrow_move())
1365 return *
this = std::move(__str);
1383 assign(
const basic_string& __str, size_type __pos, size_type __n)
1384 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1385 + __str._M_check(__pos,
"basic_string::assign"),
1386 __str._M_limit(__pos, __n)); }
1399 assign(
const _CharT* __s, size_type __n)
1401 __glibcxx_requires_string_len(__s, __n);
1402 return _M_replace(size_type(0), this->
size(), __s, __n);
1415 assign(
const _CharT* __s)
1417 __glibcxx_requires_string(__s);
1418 return _M_replace(size_type(0), this->
size(), __s,
1419 traits_type::length(__s));
1432 assign(size_type __n, _CharT __c)
1433 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1443 #if __cplusplus >= 201103L 1444 template<
class _InputIterator,
1445 typename = std::_RequireInputIter<_InputIterator>>
1447 template<
class _InputIterator>
1450 assign(_InputIterator __first, _InputIterator __last)
1453 #if __cplusplus >= 201103L 1460 assign(initializer_list<_CharT> __l)
1461 {
return this->
assign(__l.begin(), __l.size()); }
1464 #if __cplusplus > 201402L 1470 template<
typename _Tp>
1471 _If_sv<_Tp, basic_string&>
1474 __sv_type __sv = __svt;
1475 return this->
assign(__sv.data(), __sv.size());
1485 template<
typename _Tp>
1486 _If_sv<_Tp, basic_string&>
1487 assign(
const _Tp& __svt, size_type __pos, size_type __n = npos)
1489 __sv_type __sv = __svt;
1490 return _M_replace(size_type(0), this->
size(), __sv.data()
1491 + __sv._M_check(__pos,
"basic_string::assign"),
1492 __sv._M_limit(__pos, __n));
1496 #if __cplusplus >= 201103L 1513 insert(const_iterator __p, size_type __n, _CharT __c)
1515 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1516 const size_type __pos = __p -
begin();
1517 this->
replace(__p, __p, __n, __c);
1518 return iterator(this->_M_data() + __pos);
1535 insert(iterator __p, size_type __n, _CharT __c)
1536 { this->
replace(__p, __p, __n, __c); }
1539 #if __cplusplus >= 201103L 1554 template<
class _InputIterator,
1555 typename = std::_RequireInputIter<_InputIterator>>
1557 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1559 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1560 const size_type __pos = __p -
begin();
1561 this->
replace(__p, __p, __beg, __end);
1562 return iterator(this->_M_data() + __pos);
1577 template<
class _InputIterator>
1579 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1580 { this->
replace(__p, __p, __beg, __end); }
1583 #if __cplusplus >= 201103L 1591 insert(iterator __p, initializer_list<_CharT> __l)
1593 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1594 this->
insert(__p -
begin(), __l.begin(), __l.size());
1611 insert(size_type __pos1,
const basic_string& __str)
1612 {
return this->
replace(__pos1, size_type(0),
1613 __str._M_data(), __str.size()); }
1634 insert(size_type __pos1,
const basic_string& __str,
1635 size_type __pos2, size_type __n)
1636 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1637 + __str._M_check(__pos2,
"basic_string::insert"),
1638 __str._M_limit(__pos2, __n)); }
1657 insert(size_type __pos,
const _CharT* __s, size_type __n)
1658 {
return this->
replace(__pos, size_type(0), __s, __n); }
1676 insert(size_type __pos,
const _CharT* __s)
1678 __glibcxx_requires_string(__s);
1679 return this->
replace(__pos, size_type(0), __s,
1680 traits_type::length(__s));
1700 insert(size_type __pos, size_type __n, _CharT __c)
1701 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1702 size_type(0), __n, __c); }
1718 insert(__const_iterator __p, _CharT __c)
1720 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1721 const size_type __pos = __p -
begin();
1722 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1723 return iterator(_M_data() + __pos);
1726 #if __cplusplus > 201402L 1733 template<
typename _Tp>
1734 _If_sv<_Tp, basic_string&>
1735 insert(size_type __pos,
const _Tp& __svt)
1737 __sv_type __sv = __svt;
1738 return this->
insert(__pos, __sv.data(), __sv.size());
1750 template<
typename _Tp>
1751 _If_sv<_Tp, basic_string&>
1752 insert(size_type __pos1,
const _Tp& __svt,
1753 size_type __pos2, size_type __n = npos)
1755 __sv_type __sv = __svt;
1756 return this->
replace(__pos1, size_type(0), __sv.data()
1757 + __sv._M_check(__pos2,
"basic_string::insert"),
1758 __sv._M_limit(__pos2, __n));
1778 erase(size_type __pos = 0, size_type __n = npos)
1780 _M_check(__pos,
"basic_string::erase");
1782 this->_M_set_length(__pos);
1784 this->_M_erase(__pos, _M_limit(__pos, __n));
1797 erase(__const_iterator __position)
1799 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
1800 && __position <
end());
1801 const size_type __pos = __position -
begin();
1802 this->_M_erase(__pos, size_type(1));
1803 return iterator(_M_data() + __pos);
1816 erase(__const_iterator __first, __const_iterator __last)
1818 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
1819 && __last <=
end());
1820 const size_type __pos = __first -
begin();
1821 if (__last ==
end())
1822 this->_M_set_length(__pos);
1824 this->_M_erase(__pos, __last - __first);
1825 return iterator(this->_M_data() + __pos);
1828 #if __cplusplus >= 201103L 1837 __glibcxx_assert(!
empty());
1838 _M_erase(
size() - 1, 1);
1860 replace(size_type __pos, size_type __n,
const basic_string& __str)
1861 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
1882 replace(size_type __pos1, size_type __n1,
const basic_string& __str,
1883 size_type __pos2, size_type __n2)
1884 {
return this->
replace(__pos1, __n1, __str._M_data()
1885 + __str._M_check(__pos2,
"basic_string::replace"),
1886 __str._M_limit(__pos2, __n2)); }
1907 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1910 __glibcxx_requires_string_len(__s, __n2);
1911 return _M_replace(_M_check(__pos,
"basic_string::replace"),
1912 _M_limit(__pos, __n1), __s, __n2);
1932 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1934 __glibcxx_requires_string(__s);
1935 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1956 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1957 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
1958 _M_limit(__pos, __n1), __n2, __c); }
1974 replace(__const_iterator __i1, __const_iterator __i2,
1975 const basic_string& __str)
1976 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
1994 replace(__const_iterator __i1, __const_iterator __i2,
1995 const _CharT* __s, size_type __n)
1997 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1999 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
2016 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
2018 __glibcxx_requires_string(__s);
2019 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
2037 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
2040 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2042 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
2060 #if __cplusplus >= 201103L 2061 template<
class _InputIterator,
2062 typename = std::_RequireInputIter<_InputIterator>>
2064 replace(const_iterator __i1, const_iterator __i2,
2065 _InputIterator __k1, _InputIterator __k2)
2067 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2069 __glibcxx_requires_valid_range(__k1, __k2);
2070 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
2071 std::__false_type());
2074 template<
class _InputIterator>
2075 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 2076 typename __enable_if_not_native_iterator<_InputIterator>::__type
2080 replace(iterator __i1, iterator __i2,
2081 _InputIterator __k1, _InputIterator __k2)
2083 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2085 __glibcxx_requires_valid_range(__k1, __k2);
2086 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
2087 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
2094 replace(__const_iterator __i1, __const_iterator __i2,
2095 _CharT* __k1, _CharT* __k2)
2097 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2099 __glibcxx_requires_valid_range(__k1, __k2);
2105 replace(__const_iterator __i1, __const_iterator __i2,
2106 const _CharT* __k1,
const _CharT* __k2)
2108 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2110 __glibcxx_requires_valid_range(__k1, __k2);
2116 replace(__const_iterator __i1, __const_iterator __i2,
2117 iterator __k1, iterator __k2)
2119 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2121 __glibcxx_requires_valid_range(__k1, __k2);
2123 __k1.base(), __k2 - __k1);
2127 replace(__const_iterator __i1, __const_iterator __i2,
2128 const_iterator __k1, const_iterator __k2)
2130 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
2132 __glibcxx_requires_valid_range(__k1, __k2);
2134 __k1.base(), __k2 - __k1);
2137 #if __cplusplus >= 201103L 2152 basic_string&
replace(const_iterator __i1, const_iterator __i2,
2153 initializer_list<_CharT> __l)
2154 {
return this->
replace(__i1, __i2, __l.begin(), __l.size()); }
2157 #if __cplusplus > 201402L 2165 template<
typename _Tp>
2166 _If_sv<_Tp, basic_string&>
2167 replace(size_type __pos, size_type __n,
const _Tp& __svt)
2169 __sv_type __sv = __svt;
2170 return this->
replace(__pos, __n, __sv.data(), __sv.size());
2182 template<
typename _Tp>
2183 _If_sv<_Tp, basic_string&>
2184 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
2185 size_type __pos2, size_type __n2 = npos)
2187 __sv_type __sv = __svt;
2188 return this->
replace(__pos1, __n1, __sv.data()
2189 + __sv._M_check(__pos2,
"basic_string::replace"),
2190 __sv._M_limit(__pos2, __n2));
2202 template<
typename _Tp>
2203 _If_sv<_Tp, basic_string&>
2204 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
2206 __sv_type __sv = __svt;
2207 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
2212 template<
class _Integer>
2214 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2215 _Integer __n, _Integer __val, __true_type)
2216 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
2218 template<
class _InputIterator>
2220 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
2221 _InputIterator __k1, _InputIterator __k2,
2225 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
2229 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
2230 const size_type __len2);
2233 _M_append(
const _CharT* __s, size_type __n);
2250 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
2260 swap(basic_string& __s) _GLIBCXX_NOEXCEPT;
2270 c_str() const _GLIBCXX_NOEXCEPT
2271 {
return _M_data(); }
2282 data() const _GLIBCXX_NOEXCEPT
2283 {
return _M_data(); }
2285 #if __cplusplus > 201402L 2294 {
return _M_data(); }
2302 {
return _M_get_allocator(); }
2317 find(
const _CharT* __s, size_type __pos, size_type __n)
const 2331 find(
const basic_string& __str, size_type __pos = 0) const
2333 {
return this->
find(__str.data(), __pos, __str.size()); }
2335 #if __cplusplus > 201402L 2342 template<
typename _Tp>
2343 _If_sv<_Tp, size_type>
2344 find(
const _Tp& __svt, size_type __pos = 0) const
2345 noexcept(is_same<_Tp, __sv_type>::value)
2347 __sv_type __sv = __svt;
2348 return this->
find(__sv.data(), __pos, __sv.size());
2363 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2365 __glibcxx_requires_string(__s);
2366 return this->
find(__s, __pos, traits_type::length(__s));
2380 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
2393 rfind(const basic_string& __str, size_type __pos = npos) const
2395 {
return this->
rfind(__str.data(), __pos, __str.size()); }
2397 #if __cplusplus > 201402L 2404 template<
typename _Tp>
2405 _If_sv<_Tp, size_type>
2406 rfind(
const _Tp& __svt, size_type __pos = npos)
const 2407 noexcept(is_same<_Tp, __sv_type>::value)
2409 __sv_type __sv = __svt;
2410 return this->
rfind(__sv.data(), __pos, __sv.size());
2427 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const 2441 rfind(
const _CharT* __s, size_type __pos = npos)
const 2443 __glibcxx_requires_string(__s);
2444 return this->
rfind(__s, __pos, traits_type::length(__s));
2458 rfind(_CharT __c, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT;
2472 find_first_of(
const basic_string& __str, size_type __pos = 0) const
2474 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2476 #if __cplusplus > 201402L 2484 template<
typename _Tp>
2485 _If_sv<_Tp, size_type>
2487 noexcept(is_same<_Tp, __sv_type>::value)
2489 __sv_type __sv = __svt;
2490 return this->
find_first_of(__sv.data(), __pos, __sv.size());
2507 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const 2524 __glibcxx_requires_string(__s);
2525 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2541 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2542 {
return this->
find(__c, __pos); }
2556 find_last_of(
const basic_string& __str, size_type __pos = npos)
const 2558 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2560 #if __cplusplus > 201402L 2568 template<
typename _Tp>
2569 _If_sv<_Tp, size_type>
2570 find_last_of(
const _Tp& __svt, size_type __pos = npos)
const 2571 noexcept(is_same<_Tp, __sv_type>::value)
2573 __sv_type __sv = __svt;
2574 return this->
find_last_of(__sv.data(), __pos, __sv.size());
2591 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const 2605 find_last_of(
const _CharT* __s, size_type __pos = npos)
const 2608 __glibcxx_requires_string(__s);
2609 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2625 find_last_of(_CharT __c, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT
2626 {
return this->
rfind(__c, __pos); }
2643 #if __cplusplus > 201402L 2651 template<
typename _Tp>
2652 _If_sv<_Tp, size_type>
2654 noexcept(is_same<_Tp, __sv_type>::value)
2656 __sv_type __sv = __svt;
2675 size_type __n)
const _GLIBCXX_NOEXCEPT;
2691 __glibcxx_requires_string(__s);
2725 #if __cplusplus > 201402L 2733 template<
typename _Tp>
2734 _If_sv<_Tp, size_type>
2736 noexcept(is_same<_Tp, __sv_type>::value)
2738 __sv_type __sv = __svt;
2757 size_type __n)
const _GLIBCXX_NOEXCEPT;
2773 __glibcxx_requires_string(__s);
2804 substr(size_type __pos = 0, size_type __n = npos)
const 2806 _M_check(__pos,
"basic_string::substr"), __n); }
2823 compare(
const basic_string& __str)
const 2825 const size_type __size = this->
size();
2826 const size_type __osize = __str.size();
2827 const size_type __len =
std::min(__size, __osize);
2829 int __r = traits_type::compare(_M_data(), __str.data(), __len);
2831 __r = _S_compare(__size, __osize);
2835 #if __cplusplus > 201402L 2841 template<
typename _Tp>
2843 compare(
const _Tp& __svt)
const 2844 noexcept(is_same<_Tp, __sv_type>::value)
2846 __sv_type __sv = __svt;
2847 const size_type __size = this->
size();
2848 const size_type __osize = __sv.size();
2849 const size_type __len =
std::min(__size, __osize);
2851 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
2853 __r = _S_compare(__size, __osize);
2865 template<
typename _Tp>
2867 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const 2868 noexcept(is_same<_Tp, __sv_type>::value)
2870 __sv_type __sv = __svt;
2871 return __sv_type(*this).substr(__pos, __n).compare(__sv);
2884 template<
typename _Tp>
2886 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
2887 size_type __pos2, size_type __n2 = npos)
const 2888 noexcept(is_same<_Tp, __sv_type>::value)
2890 __sv_type __sv = __svt;
2891 return __sv_type(*
this)
2892 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
2916 compare(size_type __pos, size_type __n,
const basic_string& __str)
const;
2942 compare(size_type __pos1, size_type __n1,
const basic_string& __str,
2943 size_type __pos2, size_type __n2)
const;
2960 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
2984 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
3011 compare(size_type __pos, size_type __n1,
const _CharT* __s,
3012 size_type __n2)
const;
3015 template<
typename,
typename,
typename>
friend class basic_stringbuf;
3017 _GLIBCXX_END_NAMESPACE_CXX11
3018 #else // !_GLIBCXX_USE_CXX11_ABI 3083 template<
typename _CharT,
typename _Traits,
typename _Alloc>
3086 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
3090 typedef _Traits traits_type;
3091 typedef typename _Traits::char_type value_type;
3092 typedef _Alloc allocator_type;
3093 typedef typename _CharT_alloc_type::size_type size_type;
3094 typedef typename _CharT_alloc_type::difference_type difference_type;
3095 typedef typename _CharT_alloc_type::reference reference;
3096 typedef typename _CharT_alloc_type::const_reference const_reference;
3097 typedef typename _CharT_alloc_type::pointer pointer;
3098 typedef typename _CharT_alloc_type::const_pointer const_pointer;
3099 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
3100 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
3122 size_type _M_length;
3123 size_type _M_capacity;
3124 _Atomic_word _M_refcount;
3127 struct _Rep : _Rep_base
3130 typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
3145 static const size_type _S_max_size;
3146 static const _CharT _S_terminal;
3150 static size_type _S_empty_rep_storage[];
3153 _S_empty_rep() _GLIBCXX_NOEXCEPT
3158 void* __p =
reinterpret_cast<void*
>(&_S_empty_rep_storage);
3159 return *
reinterpret_cast<_Rep*
>(__p);
3163 _M_is_leaked()
const _GLIBCXX_NOEXCEPT
3165 #if defined(__GTHREADS) 3170 return __atomic_load_n(&this->_M_refcount, __ATOMIC_RELAXED) < 0;
3172 return this->_M_refcount < 0;
3177 _M_is_shared()
const _GLIBCXX_NOEXCEPT
3179 #if defined(__GTHREADS) 3185 return __atomic_load_n(&this->_M_refcount, __ATOMIC_ACQUIRE) > 0;
3187 return this->_M_refcount > 0;
3192 _M_set_leaked() _GLIBCXX_NOEXCEPT
3193 { this->_M_refcount = -1; }
3196 _M_set_sharable() _GLIBCXX_NOEXCEPT
3197 { this->_M_refcount = 0; }
3200 _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
3202 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3203 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3206 this->_M_set_sharable();
3207 this->_M_length = __n;
3208 traits_type::assign(this->_M_refdata()[__n], _S_terminal);
3215 _M_refdata()
throw()
3216 {
return reinterpret_cast<_CharT*
>(
this + 1); }
3219 _M_grab(
const _Alloc& __alloc1,
const _Alloc& __alloc2)
3221 return (!_M_is_leaked() && __alloc1 == __alloc2)
3222 ? _M_refcopy() : _M_clone(__alloc1);
3227 _S_create(size_type, size_type,
const _Alloc&);
3230 _M_dispose(
const _Alloc& __a) _GLIBCXX_NOEXCEPT
3232 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3233 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3237 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
3246 if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
3249 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
3256 _M_destroy(
const _Alloc&)
throw();
3259 _M_refcopy()
throw()
3261 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3262 if (__builtin_expect(
this != &_S_empty_rep(),
false))
3264 __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
3265 return _M_refdata();
3269 _M_clone(
const _Alloc&, size_type __res = 0);
3273 struct _Alloc_hider : _Alloc
3275 _Alloc_hider(_CharT* __dat,
const _Alloc& __a) _GLIBCXX_NOEXCEPT
3276 : _Alloc(__a), _M_p(__dat) { }
3286 static const size_type npos =
static_cast<size_type
>(-1);
3290 mutable _Alloc_hider _M_dataplus;
3293 _M_data() const _GLIBCXX_NOEXCEPT
3294 {
return _M_dataplus._M_p; }
3297 _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
3298 {
return (_M_dataplus._M_p = __p); }
3301 _M_rep()
const _GLIBCXX_NOEXCEPT
3302 {
return &((
reinterpret_cast<_Rep*
> (_M_data()))[-1]); }
3307 _M_ibegin()
const _GLIBCXX_NOEXCEPT
3308 {
return iterator(_M_data()); }
3311 _M_iend()
const _GLIBCXX_NOEXCEPT
3312 {
return iterator(_M_data() + this->
size()); }
3317 if (!_M_rep()->_M_is_leaked())
3322 _M_check(size_type __pos,
const char* __s)
const 3324 if (__pos > this->
size())
3325 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 3326 "this->size() (which is %zu)"),
3327 __s, __pos, this->
size());
3332 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 3335 __throw_length_error(__N(__s));
3340 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
3342 const bool __testoff = __off < this->
size() - __pos;
3343 return __testoff ? __off : this->
size() - __pos;
3348 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
3357 _M_copy(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
3360 traits_type::assign(*__d, *__s);
3362 traits_type::copy(__d, __s, __n);
3366 _M_move(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
3369 traits_type::assign(*__d, *__s);
3371 traits_type::move(__d, __s, __n);
3375 _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
3378 traits_type::assign(*__d, __c);
3380 traits_type::assign(__d, __n, __c);
3385 template<
class _Iterator>
3387 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
3389 for (; __k1 != __k2; ++__k1, (void)++__p)
3390 traits_type::assign(*__p, *__k1);
3394 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
3395 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
3398 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
3400 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
3403 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
3404 { _M_copy(__p, __k1, __k2 - __k1); }
3407 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
3409 { _M_copy(__p, __k1, __k2 - __k1); }
3412 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
3414 const difference_type __d = difference_type(__n1 - __n2);
3416 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
3417 return __gnu_cxx::__numeric_traits<int>::__max;
3418 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
3419 return __gnu_cxx::__numeric_traits<int>::__min;
3425 _M_mutate(size_type __pos, size_type __len1, size_type __len2);
3431 _S_empty_rep() _GLIBCXX_NOEXCEPT
3432 {
return _Rep::_S_empty_rep(); }
3434 #if __cplusplus > 201402L 3436 typedef basic_string_view<_CharT, _Traits> __sv_type;
3438 template<
typename _Tp,
typename _Res>
3439 using _If_sv = enable_if_t<
3440 __and_<is_convertible<const _Tp&, __sv_type>,
3441 __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
3446 _S_to_string_view(__sv_type __svt) noexcept
3455 explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { }
3469 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3470 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
3472 : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ }
3496 basic_string(
const basic_string& __str, size_type __pos,
3497 const _Alloc& __a = _Alloc());
3505 basic_string(
const basic_string& __str, size_type __pos,
3514 basic_string(
const basic_string& __str, size_type __pos,
3515 size_type __n,
const _Alloc& __a);
3527 const _Alloc& __a = _Alloc());
3533 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc());
3540 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc());
3542 #if __cplusplus >= 201103L 3551 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3554 : _M_dataplus(__str._M_dataplus)
3556 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3557 __str._M_data(_S_empty_rep()._M_refdata());
3559 __str._M_data(_S_construct(size_type(), _CharT(),
get_allocator()));
3577 template<
class _InputIterator>
3578 basic_string(_InputIterator __beg, _InputIterator __end,
3579 const _Alloc& __a = _Alloc());
3581 #if __cplusplus > 201402L 3589 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
3590 basic_string(
const _Tp& __t, size_type __pos, size_type __n,
3591 const _Alloc& __a = _Alloc())
3599 template<
typename _Tp,
typename = _If_sv<_Tp,
void>>
3601 basic_string(
const _Tp& __t,
const _Alloc& __a = _Alloc())
3602 :
basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { }
3612 :
basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { }
3627 {
return this->
assign(__str); }
3635 {
return this->
assign(__s); }
3651 #if __cplusplus >= 201103L 3675 this->
assign(__l.begin(), __l.size());
3680 #if __cplusplus > 201402L 3685 template<
typename _Tp>
3686 _If_sv<_Tp, basic_string&>
3688 {
return this->
assign(__svt); }
3694 operator __sv_type()
const noexcept
3695 {
return __sv_type(
data(),
size()); }
3707 return iterator(_M_data());
3716 {
return const_iterator(_M_data()); }
3726 return iterator(_M_data() + this->
size());
3735 {
return const_iterator(_M_data() + this->
size()); }
3744 {
return reverse_iterator(this->
end()); }
3751 const_reverse_iterator
3753 {
return const_reverse_iterator(this->
end()); }
3762 {
return reverse_iterator(this->
begin()); }
3769 const_reverse_iterator
3771 {
return const_reverse_iterator(this->
begin()); }
3773 #if __cplusplus >= 201103L 3780 {
return const_iterator(this->_M_data()); }
3788 {
return const_iterator(this->_M_data() + this->
size()); }
3795 const_reverse_iterator
3797 {
return const_reverse_iterator(this->
end()); }
3804 const_reverse_iterator
3806 {
return const_reverse_iterator(this->
begin()); }
3815 {
return _M_rep()->_M_length; }
3821 {
return _M_rep()->_M_length; }
3826 {
return _Rep::_S_max_size; }
3839 resize(size_type __n, _CharT __c);
3853 { this->
resize(__n, _CharT()); }
3855 #if __cplusplus >= 201103L 3860 #if __cpp_exceptions 3878 {
return _M_rep()->_M_capacity; }
3898 reserve(size_type __res_arg = 0);
3903 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 3907 if (_M_rep()->_M_is_shared())
3910 _M_data(_S_empty_rep()._M_refdata());
3913 _M_rep()->_M_set_length_and_sharable(0);
3919 { _M_mutate(0, this->
size(), 0); }
3928 {
return this->
size() == 0; }
3944 __glibcxx_assert(__pos <=
size());
3945 return _M_data()[__pos];
3963 __glibcxx_assert(__pos <=
size());
3965 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
3967 return _M_data()[__pos];
3983 if (__n >= this->
size())
3984 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 3985 "(which is %zu) >= this->size() " 3988 return _M_data()[__n];
4006 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 4007 "(which is %zu) >= this->size() " 4011 return _M_data()[__n];
4014 #if __cplusplus >= 201103L 4022 __glibcxx_assert(!
empty());
4033 __glibcxx_assert(!
empty());
4044 __glibcxx_assert(!
empty());
4055 __glibcxx_assert(!
empty());
4068 {
return this->
append(__str); }
4077 {
return this->
append(__s); }
4091 #if __cplusplus >= 201103L 4099 {
return this->
append(__l.begin(), __l.size()); }
4102 #if __cplusplus > 201402L 4108 template<
typename _Tp>
4109 _If_sv<_Tp, basic_string&>
4111 {
return this->
append(__svt); }
4120 append(
const basic_string& __str);
4136 append(
const basic_string& __str, size_type __pos, size_type __n);
4145 append(
const _CharT* __s, size_type __n);
4155 __glibcxx_requires_string(__s);
4156 return this->
append(__s, traits_type::length(__s));
4168 append(size_type __n, _CharT __c);
4170 #if __cplusplus >= 201103L 4178 {
return this->
append(__l.begin(), __l.size()); }
4189 template<
class _InputIterator>
4191 append(_InputIterator __first, _InputIterator __last)
4192 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
4194 #if __cplusplus > 201402L 4200 template<
typename _Tp>
4201 _If_sv<_Tp, basic_string&>
4204 __sv_type __sv = __svt;
4205 return this->
append(__sv.data(), __sv.size());
4216 template<
typename _Tp>
4217 _If_sv<_Tp, basic_string&>
4218 append(
const _Tp& __svt, size_type __pos, size_type __n = npos)
4220 __sv_type __sv = __svt;
4221 return append(__sv.data()
4222 + __sv._M_check(__pos,
"basic_string::append"),
4223 __sv._M_limit(__pos, __n));
4234 const size_type __len = 1 + this->
size();
4235 if (__len > this->
capacity() || _M_rep()->_M_is_shared())
4237 traits_type::assign(_M_data()[this->
size()], __c);
4238 _M_rep()->_M_set_length_and_sharable(__len);
4247 assign(
const basic_string& __str);
4249 #if __cplusplus >= 201103L 4281 assign(
const basic_string& __str, size_type __pos, size_type __n)
4282 {
return this->
assign(__str._M_data()
4283 + __str._M_check(__pos,
"basic_string::assign"),
4284 __str._M_limit(__pos, __n)); }
4297 assign(
const _CharT* __s, size_type __n);
4311 __glibcxx_requires_string(__s);
4312 return this->
assign(__s, traits_type::length(__s));
4326 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
4336 template<
class _InputIterator>
4338 assign(_InputIterator __first, _InputIterator __last)
4339 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
4341 #if __cplusplus >= 201103L 4349 {
return this->
assign(__l.begin(), __l.size()); }
4352 #if __cplusplus > 201402L 4358 template<
typename _Tp>
4359 _If_sv<_Tp, basic_string&>
4362 __sv_type __sv = __svt;
4363 return this->
assign(__sv.data(), __sv.size());
4373 template<
typename _Tp>
4374 _If_sv<_Tp, basic_string&>
4375 assign(
const _Tp& __svt, size_type __pos, size_type __n = npos)
4377 __sv_type __sv = __svt;
4378 return assign(__sv.data()
4379 + __sv._M_check(__pos,
"basic_string::assign"),
4380 __sv._M_limit(__pos, __n));
4398 insert(iterator __p, size_type __n, _CharT __c)
4399 { this->
replace(__p, __p, __n, __c); }
4413 template<
class _InputIterator>
4415 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
4416 { this->
replace(__p, __p, __beg, __end); }
4418 #if __cplusplus >= 201103L 4428 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
4429 this->
insert(__p - _M_ibegin(), __l.begin(), __l.size());
4446 insert(size_type __pos1,
const basic_string& __str)
4447 {
return this->
insert(__pos1, __str, size_type(0), __str.size()); }
4468 insert(size_type __pos1,
const basic_string& __str,
4469 size_type __pos2, size_type __n)
4470 {
return this->
insert(__pos1, __str._M_data()
4471 + __str._M_check(__pos2,
"basic_string::insert"),
4472 __str._M_limit(__pos2, __n)); }
4491 insert(size_type __pos,
const _CharT* __s, size_type __n);
4511 __glibcxx_requires_string(__s);
4512 return this->
insert(__pos, __s, traits_type::length(__s));
4532 insert(size_type __pos, size_type __n, _CharT __c)
4533 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
4534 size_type(0), __n, __c); }
4552 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
4553 const size_type __pos = __p - _M_ibegin();
4554 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
4555 _M_rep()->_M_set_leaked();
4556 return iterator(_M_data() + __pos);
4559 #if __cplusplus > 201402L 4566 template<
typename _Tp>
4567 _If_sv<_Tp, basic_string&>
4568 insert(size_type __pos,
const _Tp& __svt)
4570 __sv_type __sv = __svt;
4571 return this->
insert(__pos, __sv.data(), __sv.size());
4583 template<
typename _Tp>
4584 _If_sv<_Tp, basic_string&>
4585 insert(size_type __pos1,
const _Tp& __svt,
4586 size_type __pos2, size_type __n = npos)
4588 __sv_type __sv = __svt;
4589 return this->
replace(__pos1, size_type(0), __sv.data()
4590 + __sv._M_check(__pos2,
"basic_string::insert"),
4591 __sv._M_limit(__pos2, __n));
4611 erase(size_type __pos = 0, size_type __n = npos)
4613 _M_mutate(_M_check(__pos,
"basic_string::erase"),
4614 _M_limit(__pos, __n), size_type(0));
4629 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
4630 && __position < _M_iend());
4631 const size_type __pos = __position - _M_ibegin();
4632 _M_mutate(__pos, size_type(1), size_type(0));
4633 _M_rep()->_M_set_leaked();
4634 return iterator(_M_data() + __pos);
4647 erase(iterator __first, iterator __last);
4649 #if __cplusplus >= 201103L 4658 __glibcxx_assert(!
empty());
4681 replace(size_type __pos, size_type __n,
const basic_string& __str)
4682 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
4703 replace(size_type __pos1, size_type __n1,
const basic_string& __str,
4704 size_type __pos2, size_type __n2)
4705 {
return this->
replace(__pos1, __n1, __str._M_data()
4706 + __str._M_check(__pos2,
"basic_string::replace"),
4707 __str._M_limit(__pos2, __n2)); }
4728 replace(size_type __pos, size_type __n1,
const _CharT* __s,
4748 replace(size_type __pos, size_type __n1,
const _CharT* __s)
4750 __glibcxx_requires_string(__s);
4751 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
4772 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
4773 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
4774 _M_limit(__pos, __n1), __n2, __c); }
4790 replace(iterator __i1, iterator __i2,
const basic_string& __str)
4791 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
4809 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
4811 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4812 && __i2 <= _M_iend());
4813 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
4830 replace(iterator __i1, iterator __i2,
const _CharT* __s)
4832 __glibcxx_requires_string(__s);
4833 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
4851 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
4853 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4854 && __i2 <= _M_iend());
4855 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
4873 template<
class _InputIterator>
4876 _InputIterator __k1, _InputIterator __k2)
4878 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4879 && __i2 <= _M_iend());
4880 __glibcxx_requires_valid_range(__k1, __k2);
4881 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
4882 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
4888 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
4890 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4891 && __i2 <= _M_iend());
4892 __glibcxx_requires_valid_range(__k1, __k2);
4893 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4898 replace(iterator __i1, iterator __i2,
4899 const _CharT* __k1,
const _CharT* __k2)
4901 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4902 && __i2 <= _M_iend());
4903 __glibcxx_requires_valid_range(__k1, __k2);
4904 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4909 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
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,
4915 __k1.base(), __k2 - __k1);
4919 replace(iterator __i1, iterator __i2,
4920 const_iterator __k1, const_iterator __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,
4926 __k1.base(), __k2 - __k1);
4929 #if __cplusplus >= 201103L 4944 basic_string&
replace(iterator __i1, iterator __i2,
4946 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
4949 #if __cplusplus > 201402L 4957 template<
typename _Tp>
4958 _If_sv<_Tp, basic_string&>
4959 replace(size_type __pos, size_type __n,
const _Tp& __svt)
4961 __sv_type __sv = __svt;
4962 return this->
replace(__pos, __n, __sv.data(), __sv.size());
4974 template<
typename _Tp>
4975 _If_sv<_Tp, basic_string&>
4976 replace(size_type __pos1, size_type __n1,
const _Tp& __svt,
4977 size_type __pos2, size_type __n2 = npos)
4979 __sv_type __sv = __svt;
4980 return this->
replace(__pos1, __n1,
4981 __sv.data() + __sv._M_check(__pos2,
"basic_string::replace"),
4982 __sv._M_limit(__pos2, __n2));
4994 template<
typename _Tp>
4995 _If_sv<_Tp, basic_string&>
4996 replace(const_iterator __i1, const_iterator __i2,
const _Tp& __svt)
4998 __sv_type __sv = __svt;
4999 return this->
replace(__i1 -
begin(), __i2 - __i1, __sv);
5004 template<
class _Integer>
5006 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
5007 _Integer __val, __true_type)
5008 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
5010 template<
class _InputIterator>
5012 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
5013 _InputIterator __k2, __false_type);
5016 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
5020 _M_replace_safe(size_type __pos1, size_type __n1,
const _CharT* __s,
5025 template<
class _InIterator>
5027 _S_construct_aux(_InIterator __beg, _InIterator __end,
5028 const _Alloc& __a, __false_type)
5030 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
5031 return _S_construct(__beg, __end, __a, _Tag());
5036 template<
class _Integer>
5038 _S_construct_aux(_Integer __beg, _Integer __end,
5039 const _Alloc& __a, __true_type)
5040 {
return _S_construct_aux_2(static_cast<size_type>(__beg),
5044 _S_construct_aux_2(size_type __req, _CharT __c,
const _Alloc& __a)
5045 {
return _S_construct(__req, __c, __a); }
5047 template<
class _InIterator>
5049 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a)
5051 typedef typename std::__is_integer<_InIterator>::__type _Integral;
5052 return _S_construct_aux(__beg, __end, __a, _Integral());
5056 template<
class _InIterator>
5058 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
5063 template<
class _FwdIterator>
5065 _S_construct(_FwdIterator __beg, _FwdIterator __end,
const _Alloc& __a,
5069 _S_construct(size_type __req, _CharT __c,
const _Alloc& __a);
5086 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
5097 swap(basic_string& __s);
5108 {
return _M_data(); }
5120 {
return _M_data(); }
5122 #if __cplusplus > 201402L 5131 {
return _M_data(); }
5139 {
return _M_dataplus; }
5154 find(
const _CharT* __s, size_type __pos, size_type __n)
const 5168 find(
const basic_string& __str, size_type __pos = 0) const
5170 {
return this->
find(__str.data(), __pos, __str.size()); }
5183 find(
const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
5185 __glibcxx_requires_string(__s);
5186 return this->
find(__s, __pos, traits_type::length(__s));
5200 find(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT;
5202 #if __cplusplus > 201402L 5209 template<
typename _Tp>
5210 _If_sv<_Tp, size_type>
5211 find(
const _Tp& __svt, size_type __pos = 0)
const 5212 noexcept(is_same<_Tp, __sv_type>::value)
5214 __sv_type __sv = __svt;
5215 return this->
find(__sv.data(), __pos, __sv.size());
5230 rfind(
const basic_string& __str, size_type __pos = npos)
const 5232 {
return this->
rfind(__str.data(), __pos, __str.size()); }
5247 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const 5261 rfind(
const _CharT* __s, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT
5263 __glibcxx_requires_string(__s);
5264 return this->
rfind(__s, __pos, traits_type::length(__s));
5278 rfind(_CharT __c, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT;
5280 #if __cplusplus > 201402L 5287 template<
typename _Tp>
5288 _If_sv<_Tp, size_type>
5289 rfind(
const _Tp& __svt, size_type __pos = npos)
const 5290 noexcept(is_same<_Tp, __sv_type>::value)
5292 __sv_type __sv = __svt;
5293 return this->
rfind(__sv.data(), __pos, __sv.size());
5311 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
5326 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const 5343 __glibcxx_requires_string(__s);
5344 return this->
find_first_of(__s, __pos, traits_type::length(__s));
5361 {
return this->
find(__c, __pos); }
5363 #if __cplusplus > 201402L 5371 template<
typename _Tp>
5372 _If_sv<_Tp, size_type>
5374 noexcept(is_same<_Tp, __sv_type>::value)
5376 __sv_type __sv = __svt;
5377 return this->
find_first_of(__sv.data(), __pos, __sv.size());
5395 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
5410 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const 5427 __glibcxx_requires_string(__s);
5428 return this->
find_last_of(__s, __pos, traits_type::length(__s));
5445 {
return this->
rfind(__c, __pos); }
5447 #if __cplusplus > 201402L 5455 template<
typename _Tp>
5456 _If_sv<_Tp, size_type>
5457 find_last_of(
const _Tp& __svt, size_type __pos = npos)
const 5458 noexcept(is_same<_Tp, __sv_type>::value)
5460 __sv_type __sv = __svt;
5461 return this->
find_last_of(__sv.data(), __pos, __sv.size());
5494 size_type __n)
const _GLIBCXX_NOEXCEPT;
5510 __glibcxx_requires_string(__s);
5528 #if __cplusplus > 201402L 5536 template<
typename _Tp>
5537 _If_sv<_Tp, size_type>
5539 noexcept(is_same<_Tp, __sv_type>::value)
5541 __sv_type __sv = __svt;
5576 size_type __n)
const _GLIBCXX_NOEXCEPT;
5592 __glibcxx_requires_string(__s);
5610 #if __cplusplus > 201402L 5618 template<
typename _Tp>
5619 _If_sv<_Tp, size_type>
5621 noexcept(is_same<_Tp, __sv_type>::value)
5623 __sv_type __sv = __svt;
5641 substr(size_type __pos = 0, size_type __n = npos)
const 5643 _M_check(__pos,
"basic_string::substr"), __n); }
5662 const size_type __size = this->
size();
5663 const size_type __osize = __str.size();
5664 const size_type __len =
std::min(__size, __osize);
5666 int __r = traits_type::compare(_M_data(), __str.data(), __len);
5668 __r = _S_compare(__size, __osize);
5672 #if __cplusplus > 201402L 5678 template<
typename _Tp>
5680 compare(
const _Tp& __svt)
const 5681 noexcept(is_same<_Tp, __sv_type>::value)
5683 __sv_type __sv = __svt;
5684 const size_type __size = this->
size();
5685 const size_type __osize = __sv.size();
5686 const size_type __len =
std::min(__size, __osize);
5688 int __r = traits_type::compare(_M_data(), __sv.data(), __len);
5690 __r = _S_compare(__size, __osize);
5702 template<
typename _Tp>
5704 compare(size_type __pos, size_type __n,
const _Tp& __svt)
const 5705 noexcept(is_same<_Tp, __sv_type>::value)
5707 __sv_type __sv = __svt;
5708 return __sv_type(*this).substr(__pos, __n).compare(__sv);
5721 template<
typename _Tp>
5723 compare(size_type __pos1, size_type __n1,
const _Tp& __svt,
5724 size_type __pos2, size_type __n2 = npos)
const 5725 noexcept(is_same<_Tp, __sv_type>::value)
5727 __sv_type __sv = __svt;
5728 return __sv_type(*
this)
5729 .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
5753 compare(size_type __pos, size_type __n,
const basic_string& __str)
const;
5779 compare(size_type __pos1, size_type __n1,
const basic_string& __str,
5780 size_type __pos2, size_type __n2)
const;
5797 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT;
5821 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
5848 compare(size_type __pos, size_type __n1,
const _CharT* __s,
5849 size_type __n2)
const;
5851 # ifdef _GLIBCXX_TM_TS_INTERNAL 5853 ::_txnal_cow_string_C1_for_exceptions(
void* that,
const char* s,
5856 ::_txnal_cow_string_c_str(
const void *that);
5858 ::_txnal_cow_string_D1(
void *that);
5860 ::_txnal_cow_string_D1_commit(
void *that);
5863 #endif // !_GLIBCXX_USE_CXX11_ABI 5872 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5878 __str.append(__rhs);
5888 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5899 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5909 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5912 const _CharT* __rhs)
5915 __str.append(__rhs);
5925 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5930 typedef typename __string_type::size_type __size_type;
5931 __string_type __str(__lhs);
5932 __str.append(__size_type(1), __rhs);
5936 #if __cplusplus >= 201103L 5937 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5941 {
return std::move(__lhs.append(__rhs)); }
5943 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5947 {
return std::move(__rhs.insert(0, __lhs)); }
5949 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5954 const auto __size = __lhs.size() + __rhs.size();
5955 const bool __cond = (__size > __lhs.capacity()
5956 && __size <= __rhs.capacity());
5957 return __cond ? std::move(__rhs.insert(0, __lhs))
5958 : std::move(__lhs.append(__rhs));
5961 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5965 {
return std::move(__rhs.insert(0, __lhs)); }
5967 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5971 {
return std::move(__rhs.insert(0, 1, __lhs)); }
5973 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5976 const _CharT* __rhs)
5977 {
return std::move(__lhs.append(__rhs)); }
5979 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5983 {
return std::move(__lhs.append(1, __rhs)); }
5993 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5998 {
return __lhs.compare(__rhs) == 0; }
6000 template<
typename _CharT>
6002 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
6005 {
return (__lhs.
size() == __rhs.
size()
6015 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6017 operator==(
const _CharT* __lhs,
6019 {
return __rhs.compare(__lhs) == 0; }
6027 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6030 const _CharT* __rhs)
6031 {
return __lhs.compare(__rhs) == 0; }
6040 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6045 {
return !(__lhs == __rhs); }
6053 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6055 operator!=(
const _CharT* __lhs,
6057 {
return !(__lhs == __rhs); }
6065 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6068 const _CharT* __rhs)
6069 {
return !(__lhs == __rhs); }
6078 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6080 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6083 {
return __lhs.
compare(__rhs) < 0; }
6091 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6093 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6094 const _CharT* __rhs)
6095 {
return __lhs.
compare(__rhs) < 0; }
6103 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6105 operator<(
const _CharT* __lhs,
6107 {
return __rhs.compare(__lhs) > 0; }
6116 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6121 {
return __lhs.compare(__rhs) > 0; }
6129 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6132 const _CharT* __rhs)
6133 {
return __lhs.compare(__rhs) > 0; }
6141 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6143 operator>(
const _CharT* __lhs,
6145 {
return __rhs.compare(__lhs) < 0; }
6154 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6156 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6159 {
return __lhs.
compare(__rhs) <= 0; }
6167 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6169 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6170 const _CharT* __rhs)
6171 {
return __lhs.
compare(__rhs) <= 0; }
6179 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6181 operator<=(
const _CharT* __lhs,
6183 {
return __rhs.compare(__lhs) >= 0; }
6192 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6197 {
return __lhs.compare(__rhs) >= 0; }
6205 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6208 const _CharT* __rhs)
6209 {
return __lhs.compare(__rhs) >= 0; }
6217 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6219 operator>=(
const _CharT* __lhs,
6221 {
return __rhs.compare(__lhs) <= 0; }
6230 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6234 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
6235 { __lhs.swap(__rhs); }
6250 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6268 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6270 operator<<(basic_ostream<_CharT, _Traits>& __os,
6275 return __ostream_insert(__os, __str.
data(), __str.
size());
6291 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6308 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6314 #if __cplusplus >= 201103L 6316 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6323 template<
typename _CharT,
typename _Traits,
typename _Alloc>
6335 #ifdef _GLIBCXX_USE_WCHAR_T 6342 _GLIBCXX_END_NAMESPACE_VERSION
6345 #if __cplusplus >= 201103L 6349 namespace std _GLIBCXX_VISIBILITY(default)
6351 _GLIBCXX_BEGIN_NAMESPACE_VERSION
6352 _GLIBCXX_BEGIN_NAMESPACE_CXX11
6354 #if _GLIBCXX_USE_C99_STDLIB 6357 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6358 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.
c_str(),
6362 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6363 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.
c_str(),
6366 inline unsigned long 6367 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6368 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.
c_str(),
6372 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6373 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.
c_str(),
6376 inline unsigned long long 6377 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
6378 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.
c_str(),
6383 stof(
const string& __str,
size_t* __idx = 0)
6384 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.
c_str(), __idx); }
6387 stod(
const string& __str,
size_t* __idx = 0)
6388 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.
c_str(), __idx); }
6391 stold(
const string& __str,
size_t* __idx = 0)
6392 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.
c_str(), __idx); }
6393 #endif // _GLIBCXX_USE_C99_STDLIB 6395 #if _GLIBCXX_USE_C99_STDIO 6400 to_string(
int __val)
6401 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(int),
6405 to_string(
unsigned __val)
6406 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6407 4 *
sizeof(unsigned),
6411 to_string(
long __val)
6412 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(long),
6416 to_string(
unsigned long __val)
6417 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6418 4 *
sizeof(
unsigned long),
6422 to_string(
long long __val)
6423 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6424 4 *
sizeof(
long long),
6428 to_string(
unsigned long long __val)
6429 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
6430 4 *
sizeof(
unsigned long long),
6434 to_string(
float __val)
6437 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
6438 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6443 to_string(
double __val)
6446 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
6447 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6452 to_string(
long double __val)
6455 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
6456 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
6459 #endif // _GLIBCXX_USE_C99_STDIO 6461 #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR 6463 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6464 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.
c_str(),
6468 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6469 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.
c_str(),
6472 inline unsigned long 6473 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6474 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.
c_str(),
6478 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6479 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.
c_str(),
6482 inline unsigned long long 6483 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
6484 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.
c_str(),
6489 stof(
const wstring& __str,
size_t* __idx = 0)
6490 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.
c_str(), __idx); }
6493 stod(
const wstring& __str,
size_t* __idx = 0)
6494 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.
c_str(), __idx); }
6497 stold(
const wstring& __str,
size_t* __idx = 0)
6498 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.
c_str(), __idx); }
6500 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 6503 to_wstring(
int __val)
6504 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(int),
6508 to_wstring(
unsigned __val)
6509 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6510 4 *
sizeof(unsigned),
6514 to_wstring(
long __val)
6515 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(long),
6519 to_wstring(
unsigned long __val)
6520 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6521 4 *
sizeof(
unsigned long),
6525 to_wstring(
long long __val)
6526 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6527 4 *
sizeof(
long long),
6531 to_wstring(
unsigned long long __val)
6532 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
6533 4 *
sizeof(
unsigned long long),
6537 to_wstring(
float __val)
6540 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
6541 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6546 to_wstring(
double __val)
6549 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
6550 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6555 to_wstring(
long double __val)
6558 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
6559 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
6562 #endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF 6563 #endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR 6565 _GLIBCXX_END_NAMESPACE_CXX11
6566 _GLIBCXX_END_NAMESPACE_VERSION
6571 #if __cplusplus >= 201103L 6575 namespace std _GLIBCXX_VISIBILITY(default)
6577 _GLIBCXX_BEGIN_NAMESPACE_VERSION
6581 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X 6585 :
public __hash_base<size_t, string>
6588 operator()(
const string& __s)
const noexcept
6589 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
6596 #ifdef _GLIBCXX_USE_WCHAR_T 6600 :
public __hash_base<size_t, wstring>
6603 operator()(
const wstring& __s)
const noexcept
6604 {
return std::_Hash_impl::hash(__s.
data(),
6605 __s.
length() *
sizeof(wchar_t)); }
6614 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 6618 :
public __hash_base<size_t, u16string>
6621 operator()(
const u16string& __s)
const noexcept
6622 {
return std::_Hash_impl::hash(__s.
data(),
6623 __s.
length() *
sizeof(char16_t)); }
6633 :
public __hash_base<size_t, u32string>
6636 operator()(
const u32string& __s)
const noexcept
6637 {
return std::_Hash_impl::hash(__s.
data(),
6638 __s.
length() *
sizeof(char32_t)); }
6646 _GLIBCXX_END_NAMESPACE_VERSION
6648 #if __cplusplus > 201103L 6650 #define __cpp_lib_string_udls 201304 6652 inline namespace literals
6654 inline namespace string_literals
6656 _GLIBCXX_BEGIN_NAMESPACE_VERSION
6658 _GLIBCXX_DEFAULT_ABI_TAG
6660 operator""s(
const char* __str,
size_t __len)
6663 #ifdef _GLIBCXX_USE_WCHAR_T 6664 _GLIBCXX_DEFAULT_ABI_TAG
6666 operator""s(
const wchar_t* __str,
size_t __len)
6670 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 6671 _GLIBCXX_DEFAULT_ABI_TAG
6673 operator""s(
const char16_t* __str,
size_t __len)
6676 _GLIBCXX_DEFAULT_ABI_TAG
6678 operator""s(
const char32_t* __str,
size_t __len)
6682 _GLIBCXX_END_NAMESPACE_VERSION
6686 #endif // __cplusplus > 201103L basic_string & operator+=(initializer_list< _CharT > __l)
Append an initializer_list of characters.
const_iterator cbegin() const noexcept
Uniform interface to C++98 and C++11 allocators.
basic_string & operator=(_CharT __c)
Set value to string of length 1.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a character of C string.
const_iterator begin() const noexcept
basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
char_type widen(char __c) const
Widens characters.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
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.
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.
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
basic_string & append(const _CharT *__s)
Append a C string.
void push_back(_CharT __c)
Append a single character.
basic_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
basic_string & replace(iterator __i1, iterator __i2, const basic_string &__str)
Replace range of characters with string.
iterator insert(iterator __p, _CharT __c)
Insert one character.
basic_string & assign(const basic_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
basic_string & replace(size_type __pos1, size_type __n1, const basic_string &__str, size_type __pos2, size_type __n2)
Replace characters with value from another string.
const_reverse_iterator crbegin() const noexcept
basic_string & assign(initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
basic_string & operator+=(const basic_string &__str)
Append a string to this string.
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
reference at(size_type __n)
Provides access to the data contained in the string.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
ISO C++ entities toplevel namespace is std.
const_reverse_iterator rend() const noexcept
void insert(iterator __p, initializer_list< _CharT > __l)
Insert an initializer_list of 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.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
reverse_iterator rbegin()
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
basic_string & assign(basic_string &&__str)
Set value to contents of another string.
basic_string(basic_string &&__str) noexcept
Move construct string.
Template class basic_ostream.
basic_string & operator=(initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
const_reverse_iterator crend() const noexcept
~basic_string() noexcept
Destroy the string instance.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
void resize(size_type __n)
Resizes the string to the specified number of characters.
const_iterator cend() const noexcept
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
basic_string & assign(const _CharT *__s)
Set value to contents of a C string.
basic_string & insert(size_type __pos1, const basic_string &__str)
Insert value of a string.
size_type rfind(const _CharT *__s, size_type __pos=npos) const noexcept
Find last position of a C 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 find(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a C string.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
const_iterator end() const noexcept
basic_string & insert(size_type __pos1, const basic_string &__str, size_type __pos2, size_type __n)
Insert a substring.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
const _CharT * data() const noexcept
Return const pointer to contents.
basic_string & replace(iterator __i1, iterator __i2, initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
basic_string & operator=(const _CharT *__s)
Copy contents of s into this string.
basic_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
bool empty() const noexcept
basic_string & operator+=(_CharT __c)
Append a character.
const_reference back() const noexcept
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
basic_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
basic_string()
Default constructor creates an empty string.
Managing sequences of characters and character-like objects.
basic_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
basic_string & append(const basic_string &__str)
Append a string to this string.
One of the comparison functors.
basic_string & append(initializer_list< _CharT > __l)
Append an initializer_list of characters.
Forward iterators support a superset of input iterator operations.
basic_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
static const size_type npos
Value returned by various member functions when they fail.
Uniform interface to all pointer-like types.
basic_string & operator=(basic_string &&__str)
Move assign the value of str to this string.
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.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
basic_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
Basis for explicit traits specializations.
int compare(const basic_string &__str) const
Compare to a string.
void swap(basic_string &__s)
Swap contents with another string.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
size_type capacity() const noexcept
Primary class template hash.
basic_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
iterator erase(iterator __position)
Remove one character.
basic_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
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.
const_reference front() const noexcept
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const noexcept
Find position of a character of C string.
Template class basic_istream.
basic_string & operator+=(const _CharT *__s)
Append a C string.
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
basic_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
const_reverse_iterator rbegin() const noexcept
size_type max_size() const noexcept
Returns the size() of the largest possible string.
size_type find(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a string.