39 #ifndef _BASIC_STRING_TCC 40 #define _BASIC_STRING_TCC 1 42 #pragma GCC system_header 46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 #if _GLIBCXX_USE_CXX11_ABI 52 template<
typename _CharT,
typename _Traits,
typename _Alloc>
53 const typename basic_string<_CharT, _Traits, _Alloc>::size_type
56 template<
typename _CharT,
typename _Traits,
typename _Alloc>
60 swap(basic_string& __s) _GLIBCXX_NOEXCEPT
65 _Alloc_traits::_S_on_swap(_M_get_allocator(), __s._M_get_allocator());
68 if (__s._M_is_local())
70 if (length() && __s.length())
72 _CharT __tmp_data[_S_local_capacity + 1];
73 traits_type::copy(__tmp_data, __s._M_local_buf,
75 traits_type::copy(__s._M_local_buf, _M_local_buf,
77 traits_type::copy(_M_local_buf, __tmp_data,
80 else if (__s.length())
82 (void)_M_use_local_data();
83 traits_type::copy(_M_local_buf, __s._M_local_buf,
85 _M_length(__s.length());
91 (void)__s._M_use_local_data();
92 traits_type::copy(__s._M_local_buf, _M_local_buf,
94 __s._M_length(length());
101 const size_type __tmp_capacity = __s._M_allocated_capacity;
102 (void)__s._M_use_local_data();
103 traits_type::copy(__s._M_local_buf, _M_local_buf,
105 _M_data(__s._M_data());
106 __s._M_data(__s._M_local_buf);
107 _M_capacity(__tmp_capacity);
111 const size_type __tmp_capacity = _M_allocated_capacity;
112 if (__s._M_is_local())
114 (void)_M_use_local_data();
115 traits_type::copy(_M_local_buf, __s._M_local_buf,
117 __s._M_data(_M_data());
118 _M_data(_M_local_buf);
122 pointer __tmp_ptr = _M_data();
123 _M_data(__s._M_data());
124 __s._M_data(__tmp_ptr);
125 _M_capacity(__s._M_allocated_capacity);
127 __s._M_capacity(__tmp_capacity);
130 const size_type __tmp_length = length();
131 _M_length(__s.length());
132 __s._M_length(__tmp_length);
135 template<
typename _CharT,
typename _Traits,
typename _Alloc>
137 typename basic_string<_CharT, _Traits, _Alloc>::pointer
138 basic_string<_CharT, _Traits, _Alloc>::
139 _M_create(size_type& __capacity, size_type __old_capacity)
143 if (__capacity > max_size())
144 std::__throw_length_error(__N(
"basic_string::_M_create"));
149 if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
151 __capacity = 2 * __old_capacity;
153 if (__capacity > max_size())
154 __capacity = max_size();
159 return _Alloc_traits::allocate(_M_get_allocator(), __capacity + 1);
166 template<
typename _CharT,
typename _Traits,
typename _Alloc>
167 template<
typename _InIterator>
170 basic_string<_CharT, _Traits, _Alloc>::
171 _M_construct(_InIterator __beg, _InIterator __end,
175 size_type __capacity = size_type(_S_local_capacity);
177 pointer __p = _M_use_local_data();
179 while (__beg != __end && __len < __capacity)
181 __p[__len++] = *__beg;
188 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
191 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
193 basic_string* _M_guarded;
196 while (__beg != __end)
198 if (__len == __capacity)
201 __capacity = __len + 1;
202 pointer __another = _M_create(__capacity, __len);
203 this->_S_copy(__another, _M_data(), __len);
206 _M_capacity(__capacity);
208 traits_type::assign(_M_data()[__len++], *__beg);
212 __guard._M_guarded = 0;
214 _M_set_length(__len);
217 template<
typename _CharT,
typename _Traits,
typename _Alloc>
218 template<
typename _InIterator>
221 basic_string<_CharT, _Traits, _Alloc>::
222 _M_construct(_InIterator __beg, _InIterator __end,
225 size_type __dnew =
static_cast<size_type
>(
std::distance(__beg, __end));
227 if (__dnew > size_type(_S_local_capacity))
229 _M_data(_M_create(__dnew, size_type(0)));
239 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
242 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
244 basic_string* _M_guarded;
247 this->_S_copy_chars(_M_data(), __beg, __end);
249 __guard._M_guarded = 0;
251 _M_set_length(__dnew);
254 template<
typename _CharT,
typename _Traits,
typename _Alloc>
257 basic_string<_CharT, _Traits, _Alloc>::
258 _M_construct(size_type __n, _CharT __c)
260 if (__n > size_type(_S_local_capacity))
262 _M_data(_M_create(__n, size_type(0)));
269 this->_S_assign(_M_data(), __n, __c);
274 template<
typename _CharT,
typename _Traits,
typename _Alloc>
277 basic_string<_CharT, _Traits, _Alloc>::
278 _M_assign(
const basic_string& __str)
282 const size_type __rsize = __str.length();
283 const size_type __capacity = capacity();
285 if (__rsize > __capacity)
287 size_type __new_capacity = __rsize;
288 pointer __tmp = _M_create(__new_capacity, __capacity);
291 _M_capacity(__new_capacity);
295 this->_S_copy(_M_data(), __str._M_data(), __rsize);
297 _M_set_length(__rsize);
301 template<
typename _CharT,
typename _Traits,
typename _Alloc>
307 const size_type __capacity = capacity();
312 if (__res <= __capacity)
315 pointer __tmp = _M_create(__res, __capacity);
316 this->_S_copy(__tmp, _M_data(), length() + 1);
322 template<
typename _CharT,
typename _Traits,
typename _Alloc>
325 basic_string<_CharT, _Traits, _Alloc>::
326 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
329 const size_type __how_much = length() - __pos - __len1;
331 size_type __new_capacity = length() + __len2 - __len1;
332 pointer __r = _M_create(__new_capacity, capacity());
335 this->_S_copy(__r, _M_data(), __pos);
337 this->_S_copy(__r + __pos, __s, __len2);
339 this->_S_copy(__r + __pos + __len2,
340 _M_data() + __pos + __len1, __how_much);
344 _M_capacity(__new_capacity);
347 template<
typename _CharT,
typename _Traits,
typename _Alloc>
350 basic_string<_CharT, _Traits, _Alloc>::
351 _M_erase(size_type __pos, size_type __n)
353 const size_type __how_much = length() - __pos - __n;
355 if (__how_much && __n)
356 this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
358 _M_set_length(length() - __n);
361 template<
typename _CharT,
typename _Traits,
typename _Alloc>
370 const size_type __length = length();
371 const size_type __capacity = _M_allocated_capacity;
373 if (__length <= size_type(_S_local_capacity))
375 this->_S_copy(_M_use_local_data(), _M_data(), __length + 1);
376 _M_destroy(__capacity);
377 _M_data(_M_local_data());
380 else if (__length < __capacity)
384 = _Alloc_traits::allocate(_M_get_allocator(), __length + 1);
385 this->_S_copy(__tmp, _M_data(), __length + 1);
388 _M_capacity(__length);
397 template<
typename _CharT,
typename _Traits,
typename _Alloc>
401 resize(size_type __n, _CharT __c)
403 const size_type __size = this->
size();
405 this->append(__n - __size, __c);
406 else if (__n < __size)
407 this->_M_set_length(__n);
410 template<
typename _CharT,
typename _Traits,
typename _Alloc>
412 basic_string<_CharT, _Traits, _Alloc>&
413 basic_string<_CharT, _Traits, _Alloc>::
414 _M_append(
const _CharT* __s, size_type __n)
416 const size_type __len = __n + this->
size();
418 if (__len <= this->capacity())
421 this->_S_copy(this->_M_data() + this->
size(), __s, __n);
424 this->_M_mutate(this->
size(), size_type(0), __s, __n);
426 this->_M_set_length(__len);
430 template<
typename _CharT,
typename _Traits,
typename _Alloc>
431 template<
typename _InputIterator>
433 basic_string<_CharT, _Traits, _Alloc>&
434 basic_string<_CharT, _Traits, _Alloc>::
435 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
436 _InputIterator __k1, _InputIterator __k2,
441 const basic_string __s(__k1, __k2, this->get_allocator());
442 const size_type __n1 = __i2 - __i1;
443 return _M_replace(__i1 -
begin(), __n1, __s._M_data(),
447 template<
typename _CharT,
typename _Traits,
typename _Alloc>
449 basic_string<_CharT, _Traits, _Alloc>&
450 basic_string<_CharT, _Traits, _Alloc>::
451 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
454 _M_check_length(__n1, __n2,
"basic_string::_M_replace_aux");
456 const size_type __old_size = this->
size();
457 const size_type __new_size = __old_size + __n2 - __n1;
459 if (__new_size <= this->capacity())
461 pointer __p = this->_M_data() + __pos1;
463 const size_type __how_much = __old_size - __pos1 - __n1;
464 if (__how_much && __n1 != __n2)
465 this->_S_move(__p + __n2, __p + __n1, __how_much);
468 this->_M_mutate(__pos1, __n1, 0, __n2);
471 this->_S_assign(this->_M_data() + __pos1, __n2, __c);
473 this->_M_set_length(__new_size);
477 template<
typename _CharT,
typename _Traits,
typename _Alloc>
479 basic_string<_CharT, _Traits, _Alloc>&
480 basic_string<_CharT, _Traits, _Alloc>::
481 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
482 const size_type __len2)
484 _M_check_length(__len1, __len2,
"basic_string::_M_replace");
486 const size_type __old_size = this->
size();
487 const size_type __new_size = __old_size + __len2 - __len1;
489 if (__new_size <= this->capacity())
491 pointer __p = this->_M_data() + __pos;
493 const size_type __how_much = __old_size - __pos - __len1;
494 #if __cpp_lib_is_constant_evaluated 497 auto __newp = _Alloc_traits::allocate(_M_get_allocator(),
499 _S_copy(__newp, this->_M_data(), __pos);
500 _S_copy(__newp + __pos, __s, __len2);
501 _S_copy(__newp + __pos + __len2, __p + __len1, __how_much);
502 _S_copy(this->_M_data(), __newp, __new_size);
503 this->_M_get_allocator().deallocate(__newp, __new_size);
507 if (_M_disjunct(__s))
509 if (__how_much && __len1 != __len2)
510 this->_S_move(__p + __len2, __p + __len1, __how_much);
512 this->_S_copy(__p, __s, __len2);
517 if (__len2 && __len2 <= __len1)
518 this->_S_move(__p, __s, __len2);
519 if (__how_much && __len1 != __len2)
520 this->_S_move(__p + __len2, __p + __len1, __how_much);
523 if (__s + __len2 <= __p + __len1)
524 this->_S_move(__p, __s, __len2);
525 else if (__s >= __p + __len1)
529 const size_type __poff = (__s - __p) + (__len2 - __len1);
530 this->_S_copy(__p, __p + __poff, __len2);
534 const size_type __nleft = (__p + __len1) - __s;
535 this->_S_move(__p, __s, __nleft);
538 if (__len2 < __nleft)
539 __builtin_unreachable();
540 this->_S_copy(__p + __nleft, __p + __len2,
547 this->_M_mutate(__pos, __len1, __s, __len2);
549 this->_M_set_length(__new_size);
553 template<
typename _CharT,
typename _Traits,
typename _Alloc>
555 typename basic_string<_CharT, _Traits, _Alloc>::size_type
557 copy(_CharT* __s, size_type __n, size_type __pos)
const 559 _M_check(__pos,
"basic_string::copy");
560 __n = _M_limit(__pos, __n);
561 __glibcxx_requires_string_len(__s, __n);
563 _S_copy(__s, _M_data() + __pos, __n);
568 #if __cplusplus > 202002L 569 template<
typename _CharT,
typename _Traits,
typename _Alloc>
570 template<
typename _Operation>
572 basic_string<_CharT, _Traits, _Alloc>::
573 resize_and_overwrite(
const size_type __n, _Operation __op)
575 const size_type __capacity = capacity();
577 if (__n > __capacity)
579 auto __new_capacity = __n;
580 __p = _M_create(__new_capacity, __capacity);
581 this->_S_copy(__p, _M_data(), length());
582 #if __cpp_lib_is_constant_evaluated 584 traits_type::assign(__p + length(), __n - length(), _CharT());
588 _M_capacity(__new_capacity);
593 constexpr ~_Terminator() { _M_this->_M_set_length(_M_r); }
594 basic_string* _M_this;
597 _Terminator __term{
this};
598 auto __r =
std::move(__op)(
auto(__p),
auto(__n));
599 static_assert(ranges::__detail::__is_integer_like<decltype(__r)>);
600 _GLIBCXX_DEBUG_ASSERT(__r >= 0 && __r <= __n);
601 __term._M_r = size_type(__r);
602 if (__term._M_r > __n)
603 __builtin_unreachable();
607 #endif // _GLIBCXX_USE_CXX11_ABI 609 #if __cpp_lib_constexpr_string >= 201907L 610 # define _GLIBCXX_STRING_CONSTEXPR constexpr 612 # define _GLIBCXX_STRING_CONSTEXPR 615 template<
typename _CharT,
typename _Traits,
typename _Alloc>
617 basic_string<_CharT, _Traits, _Alloc>
621 __glibcxx_requires_string(__lhs);
623 typedef typename __string_type::size_type __size_type;
625 rebind<_CharT>::other _Char_alloc_type;
627 const __size_type __len = _Traits::length(__lhs);
628 __string_type __str(_Alloc_traits::_S_select_on_copy(
630 __str.reserve(__len + __rhs.
size());
631 __str.append(__lhs, __len);
636 template<
typename _CharT,
typename _Traits,
typename _Alloc>
642 typedef typename __string_type::size_type __size_type;
644 rebind<_CharT>::other _Char_alloc_type;
646 __string_type __str(_Alloc_traits::_S_select_on_copy(
648 const __size_type __len = __rhs.
size();
649 __str.reserve(__len + 1);
650 __str.append(__size_type(1), __lhs);
655 template<
typename _CharT,
typename _Traits,
typename _Alloc>
656 _GLIBCXX_STRING_CONSTEXPR
657 typename basic_string<_CharT, _Traits, _Alloc>::size_type
659 find(
const _CharT* __s, size_type __pos, size_type __n)
const 662 __glibcxx_requires_string_len(__s, __n);
663 const size_type __size = this->
size();
666 return __pos <= __size ? __pos : npos;
670 const _CharT __elem0 = __s[0];
671 const _CharT*
const __data =
data();
672 const _CharT* __first = __data + __pos;
673 const _CharT*
const __last = __data + __size;
674 size_type __len = __size - __pos;
679 __first = traits_type::find(__first, __len - __n + 1, __elem0);
685 if (traits_type::compare(__first, __s, __n) == 0)
686 return __first - __data;
687 __len = __last - ++__first;
692 template<
typename _CharT,
typename _Traits,
typename _Alloc>
693 _GLIBCXX_STRING_CONSTEXPR
694 typename basic_string<_CharT, _Traits, _Alloc>::size_type
696 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
698 size_type __ret = npos;
699 const size_type __size = this->
size();
702 const _CharT* __data = _M_data();
703 const size_type __n = __size - __pos;
704 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
706 __ret = __p - __data;
711 template<
typename _CharT,
typename _Traits,
typename _Alloc>
712 _GLIBCXX_STRING_CONSTEXPR
713 typename basic_string<_CharT, _Traits, _Alloc>::size_type
715 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const 718 __glibcxx_requires_string_len(__s, __n);
719 const size_type __size = this->
size();
722 __pos =
std::min(size_type(__size - __n), __pos);
723 const _CharT* __data = _M_data();
726 if (traits_type::compare(__data + __pos, __s, __n) == 0)
734 template<
typename _CharT,
typename _Traits,
typename _Alloc>
735 _GLIBCXX_STRING_CONSTEXPR
736 typename basic_string<_CharT, _Traits, _Alloc>::size_type
738 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
740 size_type __size = this->
size();
743 if (--__size > __pos)
745 for (++__size; __size-- > 0; )
746 if (traits_type::eq(_M_data()[__size], __c))
752 template<
typename _CharT,
typename _Traits,
typename _Alloc>
753 _GLIBCXX_STRING_CONSTEXPR
754 typename basic_string<_CharT, _Traits, _Alloc>::size_type
759 __glibcxx_requires_string_len(__s, __n);
760 for (; __n && __pos < this->
size(); ++__pos)
762 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
769 template<
typename _CharT,
typename _Traits,
typename _Alloc>
770 _GLIBCXX_STRING_CONSTEXPR
771 typename basic_string<_CharT, _Traits, _Alloc>::size_type
776 __glibcxx_requires_string_len(__s, __n);
777 size_type __size = this->
size();
780 if (--__size > __pos)
784 if (traits_type::find(__s, __n, _M_data()[__size]))
787 while (__size-- != 0);
792 template<
typename _CharT,
typename _Traits,
typename _Alloc>
793 _GLIBCXX_STRING_CONSTEXPR
794 typename basic_string<_CharT, _Traits, _Alloc>::size_type
799 __glibcxx_requires_string_len(__s, __n);
800 for (; __pos < this->
size(); ++__pos)
801 if (!traits_type::find(__s, __n, _M_data()[__pos]))
806 template<
typename _CharT,
typename _Traits,
typename _Alloc>
807 _GLIBCXX_STRING_CONSTEXPR
808 typename basic_string<_CharT, _Traits, _Alloc>::size_type
812 for (; __pos < this->
size(); ++__pos)
813 if (!traits_type::eq(_M_data()[__pos], __c))
818 template<
typename _CharT,
typename _Traits,
typename _Alloc>
819 _GLIBCXX_STRING_CONSTEXPR
820 typename basic_string<_CharT, _Traits, _Alloc>::size_type
825 __glibcxx_requires_string_len(__s, __n);
826 size_type __size = this->
size();
829 if (--__size > __pos)
833 if (!traits_type::find(__s, __n, _M_data()[__size]))
841 template<
typename _CharT,
typename _Traits,
typename _Alloc>
842 _GLIBCXX_STRING_CONSTEXPR
843 typename basic_string<_CharT, _Traits, _Alloc>::size_type
847 size_type __size = this->
size();
850 if (--__size > __pos)
854 if (!traits_type::eq(_M_data()[__size], __c))
862 template<
typename _CharT,
typename _Traits,
typename _Alloc>
863 _GLIBCXX_STRING_CONSTEXPR
868 _M_check(__pos,
"basic_string::compare");
869 __n = _M_limit(__pos, __n);
870 const size_type __osize = __str.
size();
871 const size_type __len =
std::min(__n, __osize);
872 int __r = traits_type::compare(_M_data() + __pos, __str.
data(), __len);
874 __r = _S_compare(__n, __osize);
878 template<
typename _CharT,
typename _Traits,
typename _Alloc>
879 _GLIBCXX_STRING_CONSTEXPR
883 size_type __pos2, size_type __n2)
const 885 _M_check(__pos1,
"basic_string::compare");
886 __str._M_check(__pos2,
"basic_string::compare");
887 __n1 = _M_limit(__pos1, __n1);
888 __n2 = __str._M_limit(__pos2, __n2);
889 const size_type __len =
std::min(__n1, __n2);
890 int __r = traits_type::compare(_M_data() + __pos1,
891 __str.
data() + __pos2, __len);
893 __r = _S_compare(__n1, __n2);
897 template<
typename _CharT,
typename _Traits,
typename _Alloc>
898 _GLIBCXX_STRING_CONSTEXPR
901 compare(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
903 __glibcxx_requires_string(__s);
904 const size_type __size = this->
size();
905 const size_type __osize = traits_type::length(__s);
906 const size_type __len =
std::min(__size, __osize);
907 int __r = traits_type::compare(_M_data(), __s, __len);
909 __r = _S_compare(__size, __osize);
913 template<
typename _CharT,
typename _Traits,
typename _Alloc>
914 _GLIBCXX_STRING_CONSTEXPR
917 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const 919 __glibcxx_requires_string(__s);
920 _M_check(__pos,
"basic_string::compare");
921 __n1 = _M_limit(__pos, __n1);
922 const size_type __osize = traits_type::length(__s);
923 const size_type __len =
std::min(__n1, __osize);
924 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
926 __r = _S_compare(__n1, __osize);
930 template<
typename _CharT,
typename _Traits,
typename _Alloc>
931 _GLIBCXX_STRING_CONSTEXPR
934 compare(size_type __pos, size_type __n1,
const _CharT* __s,
935 size_type __n2)
const 937 __glibcxx_requires_string_len(__s, __n2);
938 _M_check(__pos,
"basic_string::compare");
939 __n1 = _M_limit(__pos, __n1);
940 const size_type __len =
std::min(__n1, __n2);
941 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
943 __r = _S_compare(__n1, __n2);
947 #undef _GLIBCXX_STRING_CONSTEXPR 950 template<
typename _CharT,
typename _Traits,
typename _Alloc>
957 typedef typename __istream_type::ios_base __ios_base;
958 typedef typename __istream_type::int_type __int_type;
959 typedef typename __string_type::size_type __size_type;
961 typedef typename __ctype_type::ctype_base __ctype_base;
963 __size_type __extracted = 0;
964 typename __ios_base::iostate __err = __ios_base::goodbit;
965 typename __istream_type::sentry __cerb(__in,
false);
973 __size_type __len = 0;
975 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
977 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
978 const __int_type __eof = _Traits::eof();
979 __int_type __c = __in.
rdbuf()->sgetc();
981 while (__extracted < __n
982 && !_Traits::eq_int_type(__c, __eof)
983 && !__ct.is(__ctype_base::space,
984 _Traits::to_char_type(__c)))
986 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
988 __str.
append(__buf,
sizeof(__buf) /
sizeof(_CharT));
991 __buf[__len++] = _Traits::to_char_type(__c);
993 __c = __in.
rdbuf()->snextc();
995 __str.
append(__buf, __len);
997 if (__extracted < __n && _Traits::eq_int_type(__c, __eof))
998 __err |= __ios_base::eofbit;
1003 __in._M_setstate(__ios_base::badbit);
1004 __throw_exception_again;
1011 __in._M_setstate(__ios_base::badbit);
1016 __err |= __ios_base::failbit;
1022 template<
typename _CharT,
typename _Traits,
typename _Alloc>
1029 typedef typename __istream_type::ios_base __ios_base;
1030 typedef typename __istream_type::int_type __int_type;
1031 typedef typename __string_type::size_type __size_type;
1033 __size_type __extracted = 0;
1034 const __size_type __n = __str.
max_size();
1035 typename __ios_base::iostate __err = __ios_base::goodbit;
1036 typename __istream_type::sentry __cerb(__in,
true);
1042 const __int_type __idelim = _Traits::to_int_type(__delim);
1043 const __int_type __eof = _Traits::eof();
1044 __int_type __c = __in.
rdbuf()->sgetc();
1046 while (__extracted < __n
1047 && !_Traits::eq_int_type(__c, __eof)
1048 && !_Traits::eq_int_type(__c, __idelim))
1050 __str += _Traits::to_char_type(__c);
1052 __c = __in.
rdbuf()->snextc();
1055 if (_Traits::eq_int_type(__c, __eof))
1056 __err |= __ios_base::eofbit;
1057 else if (_Traits::eq_int_type(__c, __idelim))
1060 __in.
rdbuf()->sbumpc();
1063 __err |= __ios_base::failbit;
1067 __in._M_setstate(__ios_base::badbit);
1068 __throw_exception_again;
1075 __in._M_setstate(__ios_base::badbit);
1079 __err |= __ios_base::failbit;
1087 #if _GLIBCXX_EXTERN_TEMPLATE 1093 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0 1095 # elif ! _GLIBCXX_USE_CXX11_ABI 1107 operator<<(basic_ostream<char>&,
const string&);
1115 #ifdef _GLIBCXX_USE_WCHAR_T 1116 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0 1118 # elif ! _GLIBCXX_USE_CXX11_ABI 1119 extern template basic_string<wchar_t>::size_type
1128 operator<<(basic_ostream<wchar_t>&,
const wstring&);
1135 #endif // _GLIBCXX_USE_WCHAR_T 1136 #endif // _GLIBCXX_EXTERN_TEMPLATE 1138 _GLIBCXX_END_NAMESPACE_VERSION
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
const _CharT * data() const noexcept
Return const pointer to contents.
int compare(const basic_string &__str) const
Compare to a string.
void reserve()
Equivalent to shrink_to_fit().
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 copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Forward iterators support a superset of input iterator operations.
Uniform interface to C++98 and C++11 allocators.
size_type find_last_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
ISO C++ entities toplevel namespace is std.
basic_string & append(const basic_string &__str)
Append a string to this string.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Managing sequences of characters and character-like objects.
streamsize width() const
Flags access.
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.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
static const size_type npos
Value returned by various member functions when they fail.
size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
Template class basic_istream.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
void swap(basic_string &__s) noexcept(/*conditional */)
Swap contents with another string.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
Primary class template ctype facet.This template class defines classification and conversion function...
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
void setstate(iostate __state)
Sets additional flags in the error state.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
locale getloc() const
Locale access.