39#ifndef _BASIC_STRING_TCC
40#define _BASIC_STRING_TCC 1
42#pragma GCC system_header
46namespace 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())
83 traits_type::copy(_M_local_buf, __s._M_local_buf,
85 _M_length(__s.length());
91 __s._M_init_local_buf();
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 __s._M_init_local_buf();
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())
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 _S_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);
179 while (__beg != __end && __len < __capacity)
181 _M_local_buf[__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))
376 this->_S_copy(_M_local_buf, _M_data(), __length + 1);
377 _M_destroy(__capacity);
378 _M_data(_M_local_data());
381 else if (__length < __capacity)
384 pointer __tmp = _S_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>
478 __attribute__((__noinline__, __noclone__, __cold__))
void
479 basic_string<_CharT, _Traits, _Alloc>::
480 _M_replace_cold(pointer __p, size_type __len1,
const _CharT* __s,
481 const size_type __len2,
const size_type __how_much)
484 if (__len2 && __len2 <= __len1)
485 this->_S_move(__p, __s, __len2);
486 if (__how_much && __len1 != __len2)
487 this->_S_move(__p + __len2, __p + __len1, __how_much);
490 if (__s + __len2 <= __p + __len1)
491 this->_S_move(__p, __s, __len2);
492 else if (__s >= __p + __len1)
496 const size_type __poff = (__s - __p) + (__len2 - __len1);
497 this->_S_copy(__p, __p + __poff, __len2);
501 const size_type __nleft = (__p + __len1) - __s;
502 this->_S_move(__p, __s, __nleft);
503 this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft);
508 template<
typename _CharT,
typename _Traits,
typename _Alloc>
510 basic_string<_CharT, _Traits, _Alloc>&
511 basic_string<_CharT, _Traits, _Alloc>::
512 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
513 const size_type __len2)
515 _M_check_length(__len1, __len2,
"basic_string::_M_replace");
517 const size_type __old_size = this->
size();
518 const size_type __new_size = __old_size + __len2 - __len1;
520 if (__new_size <= this->capacity())
522 pointer __p = this->_M_data() + __pos;
524 const size_type __how_much = __old_size - __pos - __len1;
525#if __cpp_lib_is_constant_evaluated
528 auto __newp = _S_allocate(_M_get_allocator(), __new_size);
529 _S_copy(__newp, this->_M_data(), __pos);
530 _S_copy(__newp + __pos, __s, __len2);
531 _S_copy(__newp + __pos + __len2, __p + __len1, __how_much);
532 _S_copy(this->_M_data(), __newp, __new_size);
533 this->_M_get_allocator().deallocate(__newp, __new_size);
537 if (__builtin_expect(_M_disjunct(__s),
true))
539 if (__how_much && __len1 != __len2)
540 this->_S_move(__p + __len2, __p + __len1, __how_much);
542 this->_S_copy(__p, __s, __len2);
545 _M_replace_cold(__p, __len1, __s, __len2, __how_much);
548 this->_M_mutate(__pos, __len1, __s, __len2);
550 this->_M_set_length(__new_size);
554 template<
typename _CharT,
typename _Traits,
typename _Alloc>
556 typename basic_string<_CharT, _Traits, _Alloc>::size_type
558 copy(_CharT* __s, size_type __n, size_type __pos)
const
560 _M_check(__pos,
"basic_string::copy");
561 __n = _M_limit(__pos, __n);
562 __glibcxx_requires_string_len(__s, __n);
564 _S_copy(__s, _M_data() + __pos, __n);
569#if __cplusplus > 202002L
570 template<
typename _CharT,
typename _Traits,
typename _Alloc>
571 template<
typename _Operation>
573 basic_string<_CharT, _Traits, _Alloc>::
574 resize_and_overwrite(
const size_type __n, _Operation __op)
576 const size_type __capacity = capacity();
578 if (__n > __capacity)
580 auto __new_capacity = __n;
581 __p = _M_create(__new_capacity, __capacity);
582 this->_S_copy(__p, _M_data(), length());
583#if __cpp_lib_is_constant_evaluated
585 traits_type::assign(__p + length(), __n - length(), _CharT());
589 _M_capacity(__new_capacity);
594 constexpr ~_Terminator() { _M_this->_M_set_length(_M_r); }
595 basic_string* _M_this;
598 _Terminator __term{
this};
599 auto __r =
std::move(__op)(
auto(__p),
auto(__n));
600 static_assert(ranges::__detail::__is_integer_like<
decltype(__r)>);
601 _GLIBCXX_DEBUG_ASSERT(__r >= 0 && __r <= __n);
602 __term._M_r = size_type(__r);
603 if (__term._M_r > __n)
604 __builtin_unreachable();
610#if __cpp_lib_constexpr_string >= 201907L
611# define _GLIBCXX_STRING_CONSTEXPR constexpr
613# define _GLIBCXX_STRING_CONSTEXPR
615 template<
typename _CharT,
typename _Traits,
typename _Alloc>
616 _GLIBCXX_STRING_CONSTEXPR
617 typename basic_string<_CharT, _Traits, _Alloc>::size_type
619 find(
const _CharT* __s, size_type __pos, size_type __n)
const
622 __glibcxx_requires_string_len(__s, __n);
623 const size_type __size = this->
size();
626 return __pos <= __size ? __pos : npos;
630 const _CharT __elem0 = __s[0];
631 const _CharT*
const __data =
data();
632 const _CharT* __first = __data + __pos;
633 const _CharT*
const __last = __data + __size;
634 size_type __len = __size - __pos;
639 __first = traits_type::find(__first, __len - __n + 1, __elem0);
645 if (traits_type::compare(__first, __s, __n) == 0)
646 return __first - __data;
647 __len = __last - ++__first;
652 template<
typename _CharT,
typename _Traits,
typename _Alloc>
653 _GLIBCXX_STRING_CONSTEXPR
654 typename basic_string<_CharT, _Traits, _Alloc>::size_type
656 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
658 size_type __ret = npos;
659 const size_type __size = this->
size();
662 const _CharT* __data = _M_data();
663 const size_type __n = __size - __pos;
664 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
666 __ret = __p - __data;
671 template<
typename _CharT,
typename _Traits,
typename _Alloc>
672 _GLIBCXX_STRING_CONSTEXPR
673 typename basic_string<_CharT, _Traits, _Alloc>::size_type
675 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
678 __glibcxx_requires_string_len(__s, __n);
679 const size_type __size = this->
size();
682 __pos =
std::min(size_type(__size - __n), __pos);
683 const _CharT* __data = _M_data();
686 if (traits_type::compare(__data + __pos, __s, __n) == 0)
694 template<
typename _CharT,
typename _Traits,
typename _Alloc>
695 _GLIBCXX_STRING_CONSTEXPR
696 typename basic_string<_CharT, _Traits, _Alloc>::size_type
698 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
700 size_type __size = this->
size();
703 if (--__size > __pos)
705 for (++__size; __size-- > 0; )
706 if (traits_type::eq(_M_data()[__size], __c))
712 template<
typename _CharT,
typename _Traits,
typename _Alloc>
713 _GLIBCXX_STRING_CONSTEXPR
714 typename basic_string<_CharT, _Traits, _Alloc>::size_type
716 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
719 __glibcxx_requires_string_len(__s, __n);
720 for (; __n && __pos < this->
size(); ++__pos)
722 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
729 template<
typename _CharT,
typename _Traits,
typename _Alloc>
730 _GLIBCXX_STRING_CONSTEXPR
731 typename basic_string<_CharT, _Traits, _Alloc>::size_type
733 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
736 __glibcxx_requires_string_len(__s, __n);
737 size_type __size = this->
size();
740 if (--__size > __pos)
744 if (traits_type::find(__s, __n, _M_data()[__size]))
747 while (__size-- != 0);
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 (; __pos < this->
size(); ++__pos)
761 if (!traits_type::find(__s, __n, _M_data()[__pos]))
766 template<
typename _CharT,
typename _Traits,
typename _Alloc>
767 _GLIBCXX_STRING_CONSTEXPR
768 typename basic_string<_CharT, _Traits, _Alloc>::size_type
772 for (; __pos < this->
size(); ++__pos)
773 if (!traits_type::eq(_M_data()[__pos], __c))
778 template<
typename _CharT,
typename _Traits,
typename _Alloc>
779 _GLIBCXX_STRING_CONSTEXPR
780 typename basic_string<_CharT, _Traits, _Alloc>::size_type
785 __glibcxx_requires_string_len(__s, __n);
786 size_type __size = this->
size();
789 if (--__size > __pos)
793 if (!traits_type::find(__s, __n, _M_data()[__size]))
801 template<
typename _CharT,
typename _Traits,
typename _Alloc>
802 _GLIBCXX_STRING_CONSTEXPR
803 typename basic_string<_CharT, _Traits, _Alloc>::size_type
807 size_type __size = this->
size();
810 if (--__size > __pos)
814 if (!traits_type::eq(_M_data()[__size], __c))
822#undef _GLIBCXX_STRING_CONSTEXPR
825 template<
typename _CharT,
typename _Traits,
typename _Alloc>
832 typedef typename __istream_type::ios_base __ios_base;
833 typedef typename __istream_type::int_type __int_type;
834 typedef typename __string_type::size_type __size_type;
836 typedef typename __ctype_type::ctype_base __ctype_base;
838 __size_type __extracted = 0;
839 typename __ios_base::iostate __err = __ios_base::goodbit;
840 typename __istream_type::sentry __cerb(__in,
false);
848 __size_type __len = 0;
850 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
852 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
853 const __int_type __eof = _Traits::eof();
854 __int_type __c = __in.
rdbuf()->sgetc();
856 while (__extracted < __n
857 && !_Traits::eq_int_type(__c, __eof)
858 && !__ct.is(__ctype_base::space,
859 _Traits::to_char_type(__c)))
861 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
863 __str.
append(__buf,
sizeof(__buf) /
sizeof(_CharT));
866 __buf[__len++] = _Traits::to_char_type(__c);
868 __c = __in.
rdbuf()->snextc();
870 __str.
append(__buf, __len);
872 if (__extracted < __n && _Traits::eq_int_type(__c, __eof))
873 __err |= __ios_base::eofbit;
878 __in._M_setstate(__ios_base::badbit);
879 __throw_exception_again;
886 __in._M_setstate(__ios_base::badbit);
891 __err |= __ios_base::failbit;
897 template<
typename _CharT,
typename _Traits,
typename _Alloc>
898 basic_istream<_CharT, _Traits>&
904 typedef typename __istream_type::ios_base __ios_base;
905 typedef typename __istream_type::int_type __int_type;
906 typedef typename __string_type::size_type __size_type;
908 __size_type __extracted = 0;
909 const __size_type __n = __str.
max_size();
910 typename __ios_base::iostate __err = __ios_base::goodbit;
911 typename __istream_type::sentry __cerb(__in,
true);
917 const __int_type __idelim = _Traits::to_int_type(__delim);
918 const __int_type __eof = _Traits::eof();
919 __int_type __c = __in.
rdbuf()->sgetc();
921 while (__extracted < __n
922 && !_Traits::eq_int_type(__c, __eof)
923 && !_Traits::eq_int_type(__c, __idelim))
925 __str += _Traits::to_char_type(__c);
927 __c = __in.
rdbuf()->snextc();
930 if (_Traits::eq_int_type(__c, __eof))
931 __err |= __ios_base::eofbit;
932 else if (_Traits::eq_int_type(__c, __idelim))
935 __in.
rdbuf()->sbumpc();
938 __err |= __ios_base::failbit;
942 __in._M_setstate(__ios_base::badbit);
943 __throw_exception_again;
950 __in._M_setstate(__ios_base::badbit);
954 __err |= __ios_base::failbit;
962#if _GLIBCXX_EXTERN_TEMPLATE
968# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
969 extern template class basic_string<char>;
970# elif ! _GLIBCXX_USE_CXX11_ABI
973 extern template basic_string<char>::size_type
974 basic_string<char>::_Rep::_S_empty_rep_storage[];
975# elif _GLIBCXX_EXTERN_TEMPLATE > 0
978 basic_string<char>::_M_replace_cold(
char *, size_type,
const char*,
979 const size_type,
const size_type);
987 operator<<(basic_ostream<char>&,
const string&);
990 getline(basic_istream<char>&,
string&,
char);
993 getline(basic_istream<char>&,
string&);
995#ifdef _GLIBCXX_USE_WCHAR_T
996# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
997 extern template class basic_string<wchar_t>;
998# elif ! _GLIBCXX_USE_CXX11_ABI
999 extern template basic_string<wchar_t>::size_type
1000 basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];
1001# elif _GLIBCXX_EXTERN_TEMPLATE > 0
1003 extern template void
1004 basic_string<wchar_t>::_M_replace_cold(
wchar_t*, size_type,
const wchar_t*,
1005 const size_type,
const size_type);
1009 basic_istream<wchar_t>&
1012 basic_ostream<wchar_t>&
1015 basic_istream<wchar_t>&
1018 basic_istream<wchar_t>&
1023_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
_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.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
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 iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
constexpr auto data(_Container &__cont) noexcept(noexcept(__cont.data())) -> decltype(__cont.data())
Return the data pointer of a container.
void setstate(iostate __state)
Sets additional flags in the error state.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
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.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
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.