39 #ifndef _BASIC_STRING_TCC
40 #define _BASIC_STRING_TCC 1
42 #ifdef _GLIBCXX_SYSHDR
43 #pragma GCC system_header
46 #pragma GCC diagnostic push
47 #pragma GCC diagnostic ignored "-Wc++11-extensions"
51 namespace std _GLIBCXX_VISIBILITY(default)
53 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 #if _GLIBCXX_USE_CXX11_ABI
57 template<
typename _CharT,
typename _Traits,
typename _Alloc>
58 const typename basic_string<_CharT, _Traits, _Alloc>::size_type
61 template<
typename _CharT,
typename _Traits,
typename _Alloc>
65 swap(basic_string& __s) _GLIBCXX_NOEXCEPT
70 _Alloc_traits::_S_on_swap(_M_get_allocator(), __s._M_get_allocator());
73 if (__s._M_is_local())
75 if (length() && __s.length())
77 _CharT __tmp_data[_S_local_capacity + 1];
78 traits_type::copy(__tmp_data, __s._M_local_buf,
80 traits_type::copy(__s._M_local_buf, _M_local_buf,
82 traits_type::copy(_M_local_buf, __tmp_data,
85 else if (__s.length())
88 traits_type::copy(_M_local_buf, __s._M_local_buf,
90 _M_length(__s.length());
96 __s._M_init_local_buf();
97 traits_type::copy(__s._M_local_buf, _M_local_buf,
99 __s._M_length(length());
106 const size_type __tmp_capacity = __s._M_allocated_capacity;
107 __s._M_init_local_buf();
108 traits_type::copy(__s._M_local_buf, _M_local_buf,
110 _M_data(__s._M_data());
111 __s._M_data(__s._M_local_buf);
112 _M_capacity(__tmp_capacity);
116 const size_type __tmp_capacity = _M_allocated_capacity;
117 if (__s._M_is_local())
120 traits_type::copy(_M_local_buf, __s._M_local_buf,
122 __s._M_data(_M_data());
123 _M_data(_M_local_buf);
127 pointer __tmp_ptr = _M_data();
128 _M_data(__s._M_data());
129 __s._M_data(__tmp_ptr);
130 _M_capacity(__s._M_allocated_capacity);
132 __s._M_capacity(__tmp_capacity);
135 const size_type __tmp_length = length();
136 _M_length(__s.length());
137 __s._M_length(__tmp_length);
140 template<
typename _CharT,
typename _Traits,
typename _Alloc>
142 typename basic_string<_CharT, _Traits, _Alloc>::pointer
143 basic_string<_CharT, _Traits, _Alloc>::
144 _M_create(size_type& __capacity, size_type __old_capacity)
148 if (__capacity > max_size())
149 std::__throw_length_error(__N(
"basic_string::_M_create"));
154 if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
156 __capacity = 2 * __old_capacity;
158 if (__capacity > max_size())
159 __capacity = max_size();
164 return _S_allocate(_M_get_allocator(), __capacity + 1);
171 template<
typename _CharT,
typename _Traits,
typename _Alloc>
172 template<
typename _InIterator>
175 basic_string<_CharT, _Traits, _Alloc>::
176 _M_construct(_InIterator __beg, _InIterator __end,
180 size_type __capacity = size_type(_S_local_capacity);
184 while (__beg != __end && __len < __capacity)
186 _M_local_buf[__len++] = *__beg;
193 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
196 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
198 basic_string* _M_guarded;
201 while (__beg != __end)
203 if (__len == __capacity)
206 __capacity = __len + 1;
207 pointer __another = _M_create(__capacity, __len);
208 this->_S_copy(__another, _M_data(), __len);
211 _M_capacity(__capacity);
213 traits_type::assign(_M_data()[__len++],
214 static_cast<_CharT
>(*__beg));
218 __guard._M_guarded = 0;
220 _M_set_length(__len);
223 template<
typename _CharT,
typename _Traits,
typename _Alloc>
224 template<
typename _InIterator>
227 basic_string<_CharT, _Traits, _Alloc>::
228 _M_construct(_InIterator __beg, _InIterator __end,
231 size_type __dnew =
static_cast<size_type
>(
std::distance(__beg, __end));
233 if (__dnew > size_type(_S_local_capacity))
235 _M_data(_M_create(__dnew, size_type(0)));
245 explicit _Guard(basic_string* __s) : _M_guarded(__s) { }
248 ~_Guard() {
if (_M_guarded) _M_guarded->_M_dispose(); }
250 basic_string* _M_guarded;
253 this->_S_copy_chars(_M_data(), __beg, __end);
255 __guard._M_guarded = 0;
257 _M_set_length(__dnew);
260 template<
typename _CharT,
typename _Traits,
typename _Alloc>
263 basic_string<_CharT, _Traits, _Alloc>::
264 _M_construct(size_type __n, _CharT __c)
266 if (__n > size_type(_S_local_capacity))
268 _M_data(_M_create(__n, size_type(0)));
275 this->_S_assign(_M_data(), __n, __c);
282 template<
typename _CharT,
typename _Traits,
typename _Alloc>
283 template<
bool _Terminated>
286 basic_string<_CharT, _Traits, _Alloc>::
287 _M_construct(
const _CharT* __str, size_type __n)
289 if (__n > size_type(_S_local_capacity))
291 _M_data(_M_create(__n, size_type(0)));
297 if (__n || _Terminated)
298 this->_S_copy(_M_data(), __str, __n + _Terminated);
302 traits_type::assign(_M_data()[__n], _CharT());
305 template<
typename _CharT,
typename _Traits,
typename _Alloc>
308 basic_string<_CharT, _Traits, _Alloc>::
309 _M_assign(
const basic_string& __str)
313 const size_type __rsize = __str.length();
314 const size_type __capacity = capacity();
316 if (__rsize > __capacity)
318 size_type __new_capacity = __rsize;
319 pointer __tmp = _M_create(__new_capacity, __capacity);
322 _M_capacity(__new_capacity);
326 this->_S_copy(_M_data(), __str._M_data(), __rsize);
328 _M_set_length(__rsize);
332 template<
typename _CharT,
typename _Traits,
typename _Alloc>
338 const size_type __capacity = capacity();
343 if (__res <= __capacity)
346 pointer __tmp = _M_create(__res, __capacity);
347 this->_S_copy(__tmp, _M_data(), length() + 1);
353 template<
typename _CharT,
typename _Traits,
typename _Alloc>
356 basic_string<_CharT, _Traits, _Alloc>::
357 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
360 const size_type __how_much = length() - __pos - __len1;
362 size_type __new_capacity = length() + __len2 - __len1;
363 pointer __r = _M_create(__new_capacity, capacity());
366 this->_S_copy(__r, _M_data(), __pos);
368 this->_S_copy(__r + __pos, __s, __len2);
370 this->_S_copy(__r + __pos + __len2,
371 _M_data() + __pos + __len1, __how_much);
375 _M_capacity(__new_capacity);
378 template<
typename _CharT,
typename _Traits,
typename _Alloc>
381 basic_string<_CharT, _Traits, _Alloc>::
382 _M_erase(size_type __pos, size_type __n)
384 const size_type __how_much = length() - __pos - __n;
386 if (__how_much && __n)
387 this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
389 _M_set_length(length() - __n);
392 template<
typename _CharT,
typename _Traits,
typename _Alloc>
401 const size_type __length = length();
402 const size_type __capacity = _M_allocated_capacity;
404 if (__length <= size_type(_S_local_capacity))
407 this->_S_copy(_M_local_buf, _M_data(), __length + 1);
408 _M_destroy(__capacity);
409 _M_data(_M_local_data());
412 else if (__length < __capacity)
415 pointer __tmp = _S_allocate(_M_get_allocator(), __length + 1);
416 this->_S_copy(__tmp, _M_data(), __length + 1);
419 _M_capacity(__length);
428 template<
typename _CharT,
typename _Traits,
typename _Alloc>
432 resize(size_type __n, _CharT __c)
434 const size_type __size = this->
size();
436 this->append(__n - __size, __c);
437 else if (__n < __size)
438 this->_M_set_length(__n);
441 template<
typename _CharT,
typename _Traits,
typename _Alloc>
443 basic_string<_CharT, _Traits, _Alloc>&
444 basic_string<_CharT, _Traits, _Alloc>::
445 _M_append(
const _CharT* __s, size_type __n)
447 const size_type __len = __n + this->
size();
449 if (__len <= this->capacity())
452 this->_S_copy(this->_M_data() + this->
size(), __s, __n);
455 this->_M_mutate(this->
size(), size_type(0), __s, __n);
457 this->_M_set_length(__len);
461 template<
typename _CharT,
typename _Traits,
typename _Alloc>
462 template<
typename _InputIterator>
464 basic_string<_CharT, _Traits, _Alloc>&
465 basic_string<_CharT, _Traits, _Alloc>::
466 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
467 _InputIterator __k1, _InputIterator __k2,
472 const basic_string __s(__k1, __k2, this->get_allocator());
473 const size_type __n1 = __i2 - __i1;
474 return _M_replace(__i1 -
begin(), __n1, __s._M_data(),
478 template<
typename _CharT,
typename _Traits,
typename _Alloc>
480 basic_string<_CharT, _Traits, _Alloc>&
481 basic_string<_CharT, _Traits, _Alloc>::
482 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
485 _M_check_length(__n1, __n2,
"basic_string::_M_replace_aux");
487 const size_type __old_size = this->
size();
488 const size_type __new_size = __old_size + __n2 - __n1;
490 if (__new_size <= this->capacity())
492 pointer __p = this->_M_data() + __pos1;
494 const size_type __how_much = __old_size - __pos1 - __n1;
495 if (__how_much && __n1 != __n2)
496 this->_S_move(__p + __n2, __p + __n1, __how_much);
499 this->_M_mutate(__pos1, __n1, 0, __n2);
502 this->_S_assign(this->_M_data() + __pos1, __n2, __c);
504 this->_M_set_length(__new_size);
508 template<
typename _CharT,
typename _Traits,
typename _Alloc>
509 __attribute__((__noinline__, __noclone__, __cold__))
void
510 basic_string<_CharT, _Traits, _Alloc>::
511 _M_replace_cold(pointer __p, size_type __len1,
const _CharT* __s,
512 const size_type __len2,
const size_type __how_much)
515 if (__len2 && __len2 <= __len1)
516 this->_S_move(__p, __s, __len2);
517 if (__how_much && __len1 != __len2)
518 this->_S_move(__p + __len2, __p + __len1, __how_much);
521 if (__s + __len2 <= __p + __len1)
522 this->_S_move(__p, __s, __len2);
523 else if (__s >= __p + __len1)
527 const size_type __poff = (__s - __p) + (__len2 - __len1);
528 this->_S_copy(__p, __p + __poff, __len2);
532 const size_type __nleft = (__p + __len1) - __s;
533 this->_S_move(__p, __s, __nleft);
534 this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft);
539 template<
typename _CharT,
typename _Traits,
typename _Alloc>
541 basic_string<_CharT, _Traits, _Alloc>&
542 basic_string<_CharT, _Traits, _Alloc>::
543 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
544 const size_type __len2)
546 _M_check_length(__len1, __len2,
"basic_string::_M_replace");
548 const size_type __old_size = this->
size();
549 const size_type __new_size = __old_size + __len2 - __len1;
551 if (__new_size <= this->capacity())
553 pointer __p = this->_M_data() + __pos;
555 const size_type __how_much = __old_size - __pos - __len1;
556 #if __cpp_lib_is_constant_evaluated
557 if (std::is_constant_evaluated())
559 auto __newp = _S_allocate(_M_get_allocator(), __new_size);
560 _S_copy(__newp, this->_M_data(), __pos);
561 _S_copy(__newp + __pos, __s, __len2);
562 _S_copy(__newp + __pos + __len2, __p + __len1, __how_much);
563 _S_copy(this->_M_data(), __newp, __new_size);
564 this->_M_get_allocator().deallocate(__newp, __new_size);
568 if (__builtin_expect(_M_disjunct(__s),
true))
570 if (__how_much && __len1 != __len2)
571 this->_S_move(__p + __len2, __p + __len1, __how_much);
573 this->_S_copy(__p, __s, __len2);
576 _M_replace_cold(__p, __len1, __s, __len2, __how_much);
579 this->_M_mutate(__pos, __len1, __s, __len2);
581 this->_M_set_length(__new_size);
585 template<
typename _CharT,
typename _Traits,
typename _Alloc>
587 typename basic_string<_CharT, _Traits, _Alloc>::size_type
589 copy(_CharT* __s, size_type __n, size_type __pos)
const
591 _M_check(__pos,
"basic_string::copy");
592 __n = _M_limit(__pos, __n);
593 __glibcxx_requires_string_len(__s, __n);
595 _S_copy(__s, _M_data() + __pos, __n);
600 #ifdef __glibcxx_string_resize_and_overwrite
601 template<
typename _CharT,
typename _Traits,
typename _Alloc>
602 template<
typename _Operation>
603 [[__gnu__::__always_inline__]]
607 { resize_and_overwrite<_Operation&>(__n, __op); }
610 #if __cplusplus >= 201103L
611 template<
typename _CharT,
typename _Traits,
typename _Alloc>
612 template<
typename _Operation>
613 _GLIBCXX20_CONSTEXPR
void
614 basic_string<_CharT, _Traits, _Alloc>::
615 #ifdef __glibcxx_string_resize_and_overwrite
616 resize_and_overwrite(
const size_type __n, _Operation __op)
618 __resize_and_overwrite(
const size_type __n, _Operation __op)
622 _CharT*
const __p = _M_data();
623 #if __cpp_lib_is_constant_evaluated
624 if (std::__is_constant_evaluated() && __n >
size())
625 traits_type::assign(__p +
size(), __n -
size(), _CharT());
628 _GLIBCXX20_CONSTEXPR ~_Terminator() { _M_this->_M_set_length(_M_r); }
629 basic_string* _M_this;
632 _Terminator __term{
this, 0};
633 auto __r =
std::move(__op)(__p + 0, __n + 0);
634 #ifdef __cpp_lib_concepts
635 static_assert(ranges::__detail::__is_integer_like<decltype(__r)>);
637 static_assert(__gnu_cxx::__is_integer_nonstrict<decltype(__r)>::__value,
638 "resize_and_overwrite operation must return an integer");
640 _GLIBCXX_DEBUG_ASSERT(__r >= 0 && size_type(__r) <= __n);
641 __term._M_r = size_type(__r);
642 if (__term._M_r > __n)
643 __builtin_unreachable();
649 #if __glibcxx_constexpr_string >= 201907L
650 # define _GLIBCXX_STRING_CONSTEXPR constexpr
652 # define _GLIBCXX_STRING_CONSTEXPR
654 template<
typename _CharT,
typename _Traits,
typename _Alloc>
655 _GLIBCXX_STRING_CONSTEXPR
656 typename basic_string<_CharT, _Traits, _Alloc>::size_type
658 find(
const _CharT* __s, size_type __pos, size_type __n)
const
661 __glibcxx_requires_string_len(__s, __n);
662 const size_type __size = this->
size();
665 return __pos <= __size ? __pos : npos;
669 const _CharT __elem0 = __s[0];
670 const _CharT*
const __data =
data();
671 const _CharT* __first = __data + __pos;
672 const _CharT*
const __last = __data + __size;
673 size_type __len = __size - __pos;
678 __first = traits_type::find(__first, __len - __n + 1, __elem0);
684 if (traits_type::compare(__first, __s, __n) == 0)
685 return __first - __data;
686 __len = __last - ++__first;
691 template<
typename _CharT,
typename _Traits,
typename _Alloc>
692 _GLIBCXX_STRING_CONSTEXPR
693 typename basic_string<_CharT, _Traits, _Alloc>::size_type
695 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
697 size_type __ret = npos;
698 const size_type __size = this->
size();
701 const _CharT* __data = _M_data();
702 const size_type __n = __size - __pos;
703 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
705 __ret = __p - __data;
710 template<
typename _CharT,
typename _Traits,
typename _Alloc>
711 _GLIBCXX_STRING_CONSTEXPR
712 typename basic_string<_CharT, _Traits, _Alloc>::size_type
714 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
717 __glibcxx_requires_string_len(__s, __n);
718 const size_type __size = this->
size();
721 __pos =
std::min(size_type(__size - __n), __pos);
722 const _CharT* __data = _M_data();
725 if (traits_type::compare(__data + __pos, __s, __n) == 0)
733 template<
typename _CharT,
typename _Traits,
typename _Alloc>
734 _GLIBCXX_STRING_CONSTEXPR
735 typename basic_string<_CharT, _Traits, _Alloc>::size_type
737 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
739 size_type __size = this->
size();
742 if (--__size > __pos)
744 for (++__size; __size-- > 0; )
745 if (traits_type::eq(_M_data()[__size], __c))
751 template<
typename _CharT,
typename _Traits,
typename _Alloc>
752 _GLIBCXX_STRING_CONSTEXPR
753 typename basic_string<_CharT, _Traits, _Alloc>::size_type
755 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
758 __glibcxx_requires_string_len(__s, __n);
759 for (; __n && __pos < this->
size(); ++__pos)
761 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
768 template<
typename _CharT,
typename _Traits,
typename _Alloc>
769 _GLIBCXX_STRING_CONSTEXPR
770 typename basic_string<_CharT, _Traits, _Alloc>::size_type
772 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
775 __glibcxx_requires_string_len(__s, __n);
776 size_type __size = this->
size();
779 if (--__size > __pos)
783 if (traits_type::find(__s, __n, _M_data()[__size]))
786 while (__size-- != 0);
791 template<
typename _CharT,
typename _Traits,
typename _Alloc>
792 _GLIBCXX_STRING_CONSTEXPR
793 typename basic_string<_CharT, _Traits, _Alloc>::size_type
798 __glibcxx_requires_string_len(__s, __n);
799 for (; __pos < this->
size(); ++__pos)
800 if (!traits_type::find(__s, __n, _M_data()[__pos]))
805 template<
typename _CharT,
typename _Traits,
typename _Alloc>
806 _GLIBCXX_STRING_CONSTEXPR
807 typename basic_string<_CharT, _Traits, _Alloc>::size_type
811 for (; __pos < this->
size(); ++__pos)
812 if (!traits_type::eq(_M_data()[__pos], __c))
817 template<
typename _CharT,
typename _Traits,
typename _Alloc>
818 _GLIBCXX_STRING_CONSTEXPR
819 typename basic_string<_CharT, _Traits, _Alloc>::size_type
824 __glibcxx_requires_string_len(__s, __n);
825 size_type __size = this->
size();
828 if (--__size > __pos)
832 if (!traits_type::find(__s, __n, _M_data()[__size]))
840 template<
typename _CharT,
typename _Traits,
typename _Alloc>
841 _GLIBCXX_STRING_CONSTEXPR
842 typename basic_string<_CharT, _Traits, _Alloc>::size_type
846 size_type __size = this->
size();
849 if (--__size > __pos)
853 if (!traits_type::eq(_M_data()[__size], __c))
861 #undef _GLIBCXX_STRING_CONSTEXPR
864 template<
typename _CharT,
typename _Traits,
typename _Alloc>
871 typedef typename __istream_type::ios_base __ios_base;
872 typedef typename __istream_type::int_type __int_type;
873 typedef typename __string_type::size_type __size_type;
875 typedef typename __ctype_type::ctype_base __ctype_base;
877 __size_type __extracted = 0;
878 typename __ios_base::iostate __err = __ios_base::goodbit;
879 typename __istream_type::sentry __cerb(__in,
false);
887 __size_type __len = 0;
889 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
891 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
892 const __int_type __eof = _Traits::eof();
893 __int_type __c = __in.
rdbuf()->sgetc();
895 while (__extracted < __n
896 && !_Traits::eq_int_type(__c, __eof)
897 && !__ct.is(__ctype_base::space,
898 _Traits::to_char_type(__c)))
900 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
902 __str.
append(__buf,
sizeof(__buf) /
sizeof(_CharT));
905 __buf[__len++] = _Traits::to_char_type(__c);
907 __c = __in.
rdbuf()->snextc();
909 __str.
append(__buf, __len);
911 if (__extracted < __n && _Traits::eq_int_type(__c, __eof))
912 __err |= __ios_base::eofbit;
917 __in._M_setstate(__ios_base::badbit);
918 __throw_exception_again;
925 __in._M_setstate(__ios_base::badbit);
930 __err |= __ios_base::failbit;
936 template<
typename _CharT,
typename _Traits,
typename _Alloc>
937 basic_istream<_CharT, _Traits>&
943 typedef typename __istream_type::ios_base __ios_base;
944 typedef typename __istream_type::int_type __int_type;
945 typedef typename __string_type::size_type __size_type;
947 __size_type __extracted = 0;
948 const __size_type __n = __str.
max_size();
949 typename __ios_base::iostate __err = __ios_base::goodbit;
950 typename __istream_type::sentry __cerb(__in,
true);
956 const __int_type __idelim = _Traits::to_int_type(__delim);
957 const __int_type __eof = _Traits::eof();
958 __int_type __c = __in.
rdbuf()->sgetc();
960 while (__extracted < __n
961 && !_Traits::eq_int_type(__c, __eof)
962 && !_Traits::eq_int_type(__c, __idelim))
964 __str += _Traits::to_char_type(__c);
966 __c = __in.
rdbuf()->snextc();
969 if (_Traits::eq_int_type(__c, __eof))
970 __err |= __ios_base::eofbit;
971 else if (_Traits::eq_int_type(__c, __idelim))
974 __in.
rdbuf()->sbumpc();
977 __err |= __ios_base::failbit;
981 __in._M_setstate(__ios_base::badbit);
982 __throw_exception_again;
989 __in._M_setstate(__ios_base::badbit);
993 __err |= __ios_base::failbit;
1001 #if _GLIBCXX_EXTERN_TEMPLATE
1007 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
1008 extern template class basic_string<char>;
1009 # elif ! _GLIBCXX_USE_CXX11_ABI
1012 extern template basic_string<char>::size_type
1013 basic_string<char>::_Rep::_S_empty_rep_storage[];
1014 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
1016 extern template void
1017 basic_string<char>::_M_replace_cold(
char *, size_type,
const char*,
1018 const size_type,
const size_type);
1022 basic_istream<char>&
1025 basic_ostream<char>&
1026 operator<<(basic_ostream<char>&,
const string&);
1028 basic_istream<char>&
1029 getline(basic_istream<char>&,
string&,
char);
1031 basic_istream<char>&
1032 getline(basic_istream<char>&,
string&);
1034 #ifdef _GLIBCXX_USE_WCHAR_T
1035 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
1036 extern template class basic_string<wchar_t>;
1037 # elif ! _GLIBCXX_USE_CXX11_ABI
1038 extern template basic_string<wchar_t>::size_type
1039 basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];
1040 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
1042 extern template void
1043 basic_string<wchar_t>::_M_replace_cold(
wchar_t*, size_type,
const wchar_t*,
1044 const size_type,
const size_type);
1048 basic_istream<wchar_t>&
1051 basic_ostream<wchar_t>&
1054 basic_istream<wchar_t>&
1057 basic_istream<wchar_t>&
1062 _GLIBCXX_END_NAMESPACE_VERSION
1065 #pragma GCC diagnostic pop
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.
void __resize_and_overwrite(size_type __n, _Operation __op)
Non-standard version of resize_and_overwrite for C++11 and above.
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.