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 traits_type::copy(_M_local_buf, __s._M_local_buf,
84 _M_length(__s.length());
90 traits_type::copy(__s._M_local_buf, _M_local_buf,
92 __s._M_length(length());
99 const size_type __tmp_capacity = __s._M_allocated_capacity;
100 traits_type::copy(__s._M_local_buf, _M_local_buf,
102 _M_data(__s._M_data());
103 __s._M_data(__s._M_local_buf);
104 _M_capacity(__tmp_capacity);
108 const size_type __tmp_capacity = _M_allocated_capacity;
109 if (__s._M_is_local())
111 traits_type::copy(_M_local_buf, __s._M_local_buf,
113 __s._M_data(_M_data());
114 _M_data(_M_local_buf);
118 pointer __tmp_ptr = _M_data();
119 _M_data(__s._M_data());
120 __s._M_data(__tmp_ptr);
121 _M_capacity(__s._M_allocated_capacity);
123 __s._M_capacity(__tmp_capacity);
126 const size_type __tmp_length = length();
127 _M_length(__s.length());
128 __s._M_length(__tmp_length);
131 template<
typename _CharT,
typename _Traits,
typename _Alloc>
133 typename basic_string<_CharT, _Traits, _Alloc>::pointer
134 basic_string<_CharT, _Traits, _Alloc>::
135 _M_create(size_type& __capacity, size_type __old_capacity)
139 if (__capacity > max_size())
140 std::__throw_length_error(__N(
"basic_string::_M_create"));
145 if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
147 __capacity = 2 * __old_capacity;
149 if (__capacity > max_size())
150 __capacity = max_size();
155 return _S_allocate(_M_get_allocator(), __capacity + 1);
162 template<
typename _CharT,
typename _Traits,
typename _Alloc>
163 template<
typename _InIterator>
166 basic_string<_CharT, _Traits, _Alloc>::
167 _M_construct(_InIterator __beg, _InIterator __end,
171 size_type __capacity = size_type(_S_local_capacity);
173 pointer __p = _M_use_local_data();
175 while (__beg != __end && __len < __capacity)
177 __p[__len++] = *__beg;
184 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
187 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
189 basic_string* _M_guarded;
192 while (__beg != __end)
194 if (__len == __capacity)
197 __capacity = __len + 1;
198 pointer __another = _M_create(__capacity, __len);
199 this->_S_copy(__another, _M_data(), __len);
202 _M_capacity(__capacity);
204 traits_type::assign(_M_data()[__len++], *__beg);
208 __guard._M_guarded = 0;
210 _M_set_length(__len);
213 template<
typename _CharT,
typename _Traits,
typename _Alloc>
214 template<
typename _InIterator>
217 basic_string<_CharT, _Traits, _Alloc>::
218 _M_construct(_InIterator __beg, _InIterator __end,
221 size_type __dnew =
static_cast<size_type
>(
std::distance(__beg, __end));
223 if (__dnew > size_type(_S_local_capacity))
225 _M_data(_M_create(__dnew, size_type(0)));
235 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
238 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
240 basic_string* _M_guarded;
243 this->_S_copy_chars(_M_data(), __beg, __end);
245 __guard._M_guarded = 0;
247 _M_set_length(__dnew);
250 template<
typename _CharT,
typename _Traits,
typename _Alloc>
253 basic_string<_CharT, _Traits, _Alloc>::
254 _M_construct(size_type __n, _CharT __c)
256 if (__n > size_type(_S_local_capacity))
258 _M_data(_M_create(__n, size_type(0)));
265 this->_S_assign(_M_data(), __n, __c);
270 template<
typename _CharT,
typename _Traits,
typename _Alloc>
273 basic_string<_CharT, _Traits, _Alloc>::
274 _M_assign(
const basic_string& __str)
278 const size_type __rsize = __str.length();
279 const size_type __capacity = capacity();
281 if (__rsize > __capacity)
283 size_type __new_capacity = __rsize;
284 pointer __tmp = _M_create(__new_capacity, __capacity);
287 _M_capacity(__new_capacity);
291 this->_S_copy(_M_data(), __str._M_data(), __rsize);
293 _M_set_length(__rsize);
297 template<
typename _CharT,
typename _Traits,
typename _Alloc>
303 const size_type __capacity = capacity();
308 if (__res <= __capacity)
311 pointer __tmp = _M_create(__res, __capacity);
312 this->_S_copy(__tmp, _M_data(), length() + 1);
318 template<
typename _CharT,
typename _Traits,
typename _Alloc>
321 basic_string<_CharT, _Traits, _Alloc>::
322 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
325 const size_type __how_much = length() - __pos - __len1;
327 size_type __new_capacity = length() + __len2 - __len1;
328 pointer __r = _M_create(__new_capacity, capacity());
331 this->_S_copy(__r, _M_data(), __pos);
333 this->_S_copy(__r + __pos, __s, __len2);
335 this->_S_copy(__r + __pos + __len2,
336 _M_data() + __pos + __len1, __how_much);
340 _M_capacity(__new_capacity);
343 template<
typename _CharT,
typename _Traits,
typename _Alloc>
346 basic_string<_CharT, _Traits, _Alloc>::
347 _M_erase(size_type __pos, size_type __n)
349 const size_type __how_much = length() - __pos - __n;
351 if (__how_much && __n)
352 this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
354 _M_set_length(length() - __n);
357 template<
typename _CharT,
typename _Traits,
typename _Alloc>
366 const size_type __length = length();
367 const size_type __capacity = _M_allocated_capacity;
369 if (__length <= size_type(_S_local_capacity))
371 this->_S_copy(_M_use_local_data(), _M_data(), __length + 1);
372 _M_destroy(__capacity);
373 _M_data(_M_local_data());
376 else if (__length < __capacity)
379 pointer __tmp = _S_allocate(_M_get_allocator(), __length + 1);
380 this->_S_copy(__tmp, _M_data(), __length + 1);
383 _M_capacity(__length);
392 template<
typename _CharT,
typename _Traits,
typename _Alloc>
396 resize(size_type __n, _CharT __c)
398 const size_type __size = this->
size();
400 this->append(__n - __size, __c);
401 else if (__n < __size)
402 this->_M_set_length(__n);
405 template<
typename _CharT,
typename _Traits,
typename _Alloc>
407 basic_string<_CharT, _Traits, _Alloc>&
408 basic_string<_CharT, _Traits, _Alloc>::
409 _M_append(
const _CharT* __s, size_type __n)
411 const size_type __len = __n + this->
size();
413 if (__len <= this->capacity())
416 this->_S_copy(this->_M_data() + this->
size(), __s, __n);
419 this->_M_mutate(this->
size(), size_type(0), __s, __n);
421 this->_M_set_length(__len);
425 template<
typename _CharT,
typename _Traits,
typename _Alloc>
426 template<
typename _InputIterator>
428 basic_string<_CharT, _Traits, _Alloc>&
429 basic_string<_CharT, _Traits, _Alloc>::
430 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
431 _InputIterator __k1, _InputIterator __k2,
436 const basic_string __s(__k1, __k2, this->get_allocator());
437 const size_type __n1 = __i2 - __i1;
438 return _M_replace(__i1 -
begin(), __n1, __s._M_data(),
442 template<
typename _CharT,
typename _Traits,
typename _Alloc>
444 basic_string<_CharT, _Traits, _Alloc>&
445 basic_string<_CharT, _Traits, _Alloc>::
446 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
449 _M_check_length(__n1, __n2,
"basic_string::_M_replace_aux");
451 const size_type __old_size = this->
size();
452 const size_type __new_size = __old_size + __n2 - __n1;
454 if (__new_size <= this->capacity())
456 pointer __p = this->_M_data() + __pos1;
458 const size_type __how_much = __old_size - __pos1 - __n1;
459 if (__how_much && __n1 != __n2)
460 this->_S_move(__p + __n2, __p + __n1, __how_much);
463 this->_M_mutate(__pos1, __n1, 0, __n2);
466 this->_S_assign(this->_M_data() + __pos1, __n2, __c);
468 this->_M_set_length(__new_size);
472 template<
typename _CharT,
typename _Traits,
typename _Alloc>
473 __attribute__((__noinline__, __noclone__, __cold__))
void
474 basic_string<_CharT, _Traits, _Alloc>::
475 _M_replace_cold(pointer __p, size_type __len1,
const _CharT* __s,
476 const size_type __len2,
const size_type __how_much)
479 if (__len2 && __len2 <= __len1)
480 this->_S_move(__p, __s, __len2);
481 if (__how_much && __len1 != __len2)
482 this->_S_move(__p + __len2, __p + __len1, __how_much);
485 if (__s + __len2 <= __p + __len1)
486 this->_S_move(__p, __s, __len2);
487 else if (__s >= __p + __len1)
491 const size_type __poff = (__s - __p) + (__len2 - __len1);
492 this->_S_copy(__p, __p + __poff, __len2);
496 const size_type __nleft = (__p + __len1) - __s;
497 this->_S_move(__p, __s, __nleft);
498 this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft);
503 template<
typename _CharT,
typename _Traits,
typename _Alloc>
505 basic_string<_CharT, _Traits, _Alloc>&
506 basic_string<_CharT, _Traits, _Alloc>::
507 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
508 const size_type __len2)
510 _M_check_length(__len1, __len2,
"basic_string::_M_replace");
512 const size_type __old_size = this->
size();
513 const size_type __new_size = __old_size + __len2 - __len1;
515 if (__new_size <= this->capacity())
517 pointer __p = this->_M_data() + __pos;
519 const size_type __how_much = __old_size - __pos - __len1;
520 #if __cpp_lib_is_constant_evaluated
523 auto __newp = _S_allocate(_M_get_allocator(), __new_size);
524 _S_copy(__newp, this->_M_data(), __pos);
525 _S_copy(__newp + __pos, __s, __len2);
526 _S_copy(__newp + __pos + __len2, __p + __len1, __how_much);
527 _S_copy(this->_M_data(), __newp, __new_size);
528 this->_M_get_allocator().deallocate(__newp, __new_size);
532 if (__builtin_expect(_M_disjunct(__s),
true))
534 if (__how_much && __len1 != __len2)
535 this->_S_move(__p + __len2, __p + __len1, __how_much);
537 this->_S_copy(__p, __s, __len2);
540 _M_replace_cold(__p, __len1, __s, __len2, __how_much);
543 this->_M_mutate(__pos, __len1, __s, __len2);
545 this->_M_set_length(__new_size);
549 template<
typename _CharT,
typename _Traits,
typename _Alloc>
551 typename basic_string<_CharT, _Traits, _Alloc>::size_type
553 copy(_CharT* __s, size_type __n, size_type __pos)
const
555 _M_check(__pos,
"basic_string::copy");
556 __n = _M_limit(__pos, __n);
557 __glibcxx_requires_string_len(__s, __n);
559 _S_copy(__s, _M_data() + __pos, __n);
564 #if __cplusplus > 202002L
565 template<
typename _CharT,
typename _Traits,
typename _Alloc>
566 template<
typename _Operation>
568 basic_string<_CharT, _Traits, _Alloc>::
569 resize_and_overwrite(size_type __n, _Operation __op)
571 const size_type __capacity = capacity();
573 if (__n > __capacity)
575 __p = _M_create(__n, __capacity);
576 this->_S_copy(__p, _M_data(), length());
577 #if __cpp_lib_is_constant_evaluated
579 traits_type::assign(__p + length(), __n - length(), _CharT());
588 constexpr ~_Terminator() { _M_this->_M_set_length(_M_r); }
589 basic_string* _M_this;
592 _Terminator __term{
this};
593 auto __r =
std::move(__op)(
auto(__p),
auto(__n));
594 static_assert(ranges::__detail::__is_integer_like<decltype(__r)>);
595 _GLIBCXX_DEBUG_ASSERT(__r >= 0 && __r <= __n);
596 __term._M_r = size_type(__r);
597 if (__term._M_r > __n)
598 __builtin_unreachable();
604 #if __cpp_lib_constexpr_string >= 201907L
605 # define _GLIBCXX_STRING_CONSTEXPR constexpr
607 # define _GLIBCXX_STRING_CONSTEXPR
609 template<
typename _CharT,
typename _Traits,
typename _Alloc>
610 _GLIBCXX_STRING_CONSTEXPR
611 typename basic_string<_CharT, _Traits, _Alloc>::size_type
613 find(
const _CharT* __s, size_type __pos, size_type __n)
const
616 __glibcxx_requires_string_len(__s, __n);
617 const size_type __size = this->
size();
620 return __pos <= __size ? __pos : npos;
624 const _CharT __elem0 = __s[0];
625 const _CharT*
const __data =
data();
626 const _CharT* __first = __data + __pos;
627 const _CharT*
const __last = __data + __size;
628 size_type __len = __size - __pos;
633 __first = traits_type::find(__first, __len - __n + 1, __elem0);
639 if (traits_type::compare(__first, __s, __n) == 0)
640 return __first - __data;
641 __len = __last - ++__first;
646 template<
typename _CharT,
typename _Traits,
typename _Alloc>
647 _GLIBCXX_STRING_CONSTEXPR
648 typename basic_string<_CharT, _Traits, _Alloc>::size_type
650 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
652 size_type __ret = npos;
653 const size_type __size = this->
size();
656 const _CharT* __data = _M_data();
657 const size_type __n = __size - __pos;
658 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
660 __ret = __p - __data;
665 template<
typename _CharT,
typename _Traits,
typename _Alloc>
666 _GLIBCXX_STRING_CONSTEXPR
667 typename basic_string<_CharT, _Traits, _Alloc>::size_type
669 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
672 __glibcxx_requires_string_len(__s, __n);
673 const size_type __size = this->
size();
676 __pos =
std::min(size_type(__size - __n), __pos);
677 const _CharT* __data = _M_data();
680 if (traits_type::compare(__data + __pos, __s, __n) == 0)
688 template<
typename _CharT,
typename _Traits,
typename _Alloc>
689 _GLIBCXX_STRING_CONSTEXPR
690 typename basic_string<_CharT, _Traits, _Alloc>::size_type
692 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
694 size_type __size = this->
size();
697 if (--__size > __pos)
699 for (++__size; __size-- > 0; )
700 if (traits_type::eq(_M_data()[__size], __c))
706 template<
typename _CharT,
typename _Traits,
typename _Alloc>
707 _GLIBCXX_STRING_CONSTEXPR
708 typename basic_string<_CharT, _Traits, _Alloc>::size_type
710 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
713 __glibcxx_requires_string_len(__s, __n);
714 for (; __n && __pos < this->
size(); ++__pos)
716 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
723 template<
typename _CharT,
typename _Traits,
typename _Alloc>
724 _GLIBCXX_STRING_CONSTEXPR
725 typename basic_string<_CharT, _Traits, _Alloc>::size_type
727 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
730 __glibcxx_requires_string_len(__s, __n);
731 size_type __size = this->
size();
734 if (--__size > __pos)
738 if (traits_type::find(__s, __n, _M_data()[__size]))
741 while (__size-- != 0);
746 template<
typename _CharT,
typename _Traits,
typename _Alloc>
747 _GLIBCXX_STRING_CONSTEXPR
748 typename basic_string<_CharT, _Traits, _Alloc>::size_type
753 __glibcxx_requires_string_len(__s, __n);
754 for (; __pos < this->
size(); ++__pos)
755 if (!traits_type::find(__s, __n, _M_data()[__pos]))
760 template<
typename _CharT,
typename _Traits,
typename _Alloc>
761 _GLIBCXX_STRING_CONSTEXPR
762 typename basic_string<_CharT, _Traits, _Alloc>::size_type
766 for (; __pos < this->
size(); ++__pos)
767 if (!traits_type::eq(_M_data()[__pos], __c))
772 template<
typename _CharT,
typename _Traits,
typename _Alloc>
773 _GLIBCXX_STRING_CONSTEXPR
774 typename basic_string<_CharT, _Traits, _Alloc>::size_type
779 __glibcxx_requires_string_len(__s, __n);
780 size_type __size = this->
size();
783 if (--__size > __pos)
787 if (!traits_type::find(__s, __n, _M_data()[__size]))
795 template<
typename _CharT,
typename _Traits,
typename _Alloc>
796 _GLIBCXX_STRING_CONSTEXPR
797 typename basic_string<_CharT, _Traits, _Alloc>::size_type
801 size_type __size = this->
size();
804 if (--__size > __pos)
808 if (!traits_type::eq(_M_data()[__size], __c))
816 #undef _GLIBCXX_STRING_CONSTEXPR
819 template<
typename _CharT,
typename _Traits,
typename _Alloc>
826 typedef typename __istream_type::ios_base __ios_base;
827 typedef typename __istream_type::int_type __int_type;
828 typedef typename __string_type::size_type __size_type;
830 typedef typename __ctype_type::ctype_base __ctype_base;
832 __size_type __extracted = 0;
833 typename __ios_base::iostate __err = __ios_base::goodbit;
834 typename __istream_type::sentry __cerb(__in,
false);
842 __size_type __len = 0;
844 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
846 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
847 const __int_type __eof = _Traits::eof();
848 __int_type __c = __in.
rdbuf()->sgetc();
850 while (__extracted < __n
851 && !_Traits::eq_int_type(__c, __eof)
852 && !__ct.is(__ctype_base::space,
853 _Traits::to_char_type(__c)))
855 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
857 __str.
append(__buf,
sizeof(__buf) /
sizeof(_CharT));
860 __buf[__len++] = _Traits::to_char_type(__c);
862 __c = __in.
rdbuf()->snextc();
864 __str.
append(__buf, __len);
866 if (__extracted < __n && _Traits::eq_int_type(__c, __eof))
867 __err |= __ios_base::eofbit;
872 __in._M_setstate(__ios_base::badbit);
873 __throw_exception_again;
880 __in._M_setstate(__ios_base::badbit);
885 __err |= __ios_base::failbit;
891 template<
typename _CharT,
typename _Traits,
typename _Alloc>
892 basic_istream<_CharT, _Traits>&
898 typedef typename __istream_type::ios_base __ios_base;
899 typedef typename __istream_type::int_type __int_type;
900 typedef typename __string_type::size_type __size_type;
902 __size_type __extracted = 0;
903 const __size_type __n = __str.
max_size();
904 typename __ios_base::iostate __err = __ios_base::goodbit;
905 typename __istream_type::sentry __cerb(__in,
true);
911 const __int_type __idelim = _Traits::to_int_type(__delim);
912 const __int_type __eof = _Traits::eof();
913 __int_type __c = __in.
rdbuf()->sgetc();
915 while (__extracted < __n
916 && !_Traits::eq_int_type(__c, __eof)
917 && !_Traits::eq_int_type(__c, __idelim))
919 __str += _Traits::to_char_type(__c);
921 __c = __in.
rdbuf()->snextc();
924 if (_Traits::eq_int_type(__c, __eof))
925 __err |= __ios_base::eofbit;
926 else if (_Traits::eq_int_type(__c, __idelim))
929 __in.
rdbuf()->sbumpc();
932 __err |= __ios_base::failbit;
936 __in._M_setstate(__ios_base::badbit);
937 __throw_exception_again;
944 __in._M_setstate(__ios_base::badbit);
948 __err |= __ios_base::failbit;
956 #if _GLIBCXX_EXTERN_TEMPLATE
962 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
963 extern template class basic_string<char>;
964 # elif ! _GLIBCXX_USE_CXX11_ABI
967 extern template basic_string<char>::size_type
968 basic_string<char>::_Rep::_S_empty_rep_storage[];
969 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
972 basic_string<char>::_M_replace_cold(
char *, size_type,
const char*,
973 const size_type,
const size_type);
981 operator<<(basic_ostream<char>&,
const string&);
984 getline(basic_istream<char>&,
string&,
char);
987 getline(basic_istream<char>&,
string&);
989 #ifdef _GLIBCXX_USE_WCHAR_T
990 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
991 extern template class basic_string<wchar_t>;
992 # elif ! _GLIBCXX_USE_CXX11_ABI
993 extern template basic_string<wchar_t>::size_type
994 basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];
995 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
998 basic_string<wchar_t>::_M_replace_cold(
wchar_t*, size_type,
const wchar_t*,
999 const size_type,
const size_type);
1003 basic_istream<wchar_t>&
1006 basic_ostream<wchar_t>&
1009 basic_istream<wchar_t>&
1012 basic_istream<wchar_t>&
1017 _GLIBCXX_END_NAMESPACE_VERSION
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
_Tp * begin(valarray< _Tp > &__va) noexcept
Return an iterator pointing to the first element of the valarray.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
basic_string< wchar_t > wstring
A string of wchar_t.
ISO C++ entities toplevel namespace is std.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
void setstate(iostate __state)
Sets additional flags in the error state.
Template class basic_istream.
Managing sequences of characters and character-like objects.
void swap(basic_string &__s) noexcept(/*conditional */)
Swap contents with another string.
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const noexcept
Find position of a C substring.
size_type find_last_not_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character not in string.
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into 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 rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
void reserve()
Equivalent to shrink_to_fit().
basic_string & append(const basic_string &__str)
Append a string to this string.
static const size_type npos
Value returned by various member functions when they fail.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
Thrown as part of forced unwinding.
streamsize width() const
Flags access.
locale getloc() const
Locale access.
Primary class template ctype facet.
Forward iterators support a superset of input iterator operations.