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 #if __cplusplus >= 202302L
306 template<
typename _CharT,
typename _Traits,
typename _Alloc>
308 basic_string<_CharT, _Traits, _Alloc>::
309 _M_construct(basic_string&& __str, size_type __pos, size_type __n)
311 const _CharT* __start = __str._M_data() + __pos;
312 if (__n <= _S_local_capacity)
315 traits_type::copy(_M_local_buf, __start, __n);
320 if constexpr (!allocator_traits<_Alloc>::is_always_equal::value)
321 if (get_allocator() != __str.get_allocator())
323 _M_construct<false>(__start, __n);
327 _M_data(__str._M_data());
328 _M_capacity(__str._M_allocated_capacity);
329 __str._M_data(__str._M_use_local_data());
330 __str._M_set_length(0);
332 _S_move(_M_data(), _M_data() + __pos, __n);
337 template<
typename _CharT,
typename _Traits,
typename _Alloc>
340 basic_string<_CharT, _Traits, _Alloc>::
341 _M_assign(
const basic_string& __str)
345 const size_type __rsize = __str.length();
346 const size_type __capacity = capacity();
348 if (__rsize > __capacity)
350 size_type __new_capacity = __rsize;
351 pointer __tmp = _M_create(__new_capacity, __capacity);
354 _M_capacity(__new_capacity);
358 this->_S_copy(_M_data(), __str._M_data(), __rsize);
360 _M_set_length(__rsize);
364 template<
typename _CharT,
typename _Traits,
typename _Alloc>
370 const size_type __capacity = capacity();
375 if (__res <= __capacity)
378 pointer __tmp = _M_create(__res, __capacity);
379 this->_S_copy(__tmp, _M_data(), length() + 1);
385 template<
typename _CharT,
typename _Traits,
typename _Alloc>
388 basic_string<_CharT, _Traits, _Alloc>::
389 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
392 const size_type __how_much = length() - __pos - __len1;
394 size_type __new_capacity = length() + __len2 - __len1;
395 pointer __r = _M_create(__new_capacity, capacity());
398 this->_S_copy(__r, _M_data(), __pos);
400 this->_S_copy(__r + __pos, __s, __len2);
402 this->_S_copy(__r + __pos + __len2,
403 _M_data() + __pos + __len1, __how_much);
407 _M_capacity(__new_capacity);
410 template<
typename _CharT,
typename _Traits,
typename _Alloc>
413 basic_string<_CharT, _Traits, _Alloc>::
414 _M_erase(size_type __pos, size_type __n)
416 const size_type __how_much = length() - __pos - __n;
418 if (__how_much && __n)
419 this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);
421 _M_set_length(length() - __n);
424 template<
typename _CharT,
typename _Traits,
typename _Alloc>
433 const size_type __length = length();
434 const size_type __capacity = _M_allocated_capacity;
436 if (__length <= size_type(_S_local_capacity))
439 this->_S_copy(_M_local_buf, _M_data(), __length + 1);
440 _M_destroy(__capacity);
441 _M_data(_M_local_data());
444 else if (__length < __capacity)
447 pointer __tmp = _S_allocate(_M_get_allocator(), __length + 1);
448 this->_S_copy(__tmp, _M_data(), __length + 1);
451 _M_capacity(__length);
460 template<
typename _CharT,
typename _Traits,
typename _Alloc>
464 resize(size_type __n, _CharT __c)
466 const size_type __size = this->
size();
468 this->append(__n - __size, __c);
469 else if (__n < __size)
470 this->_M_set_length(__n);
473 template<
typename _CharT,
typename _Traits,
typename _Alloc>
475 basic_string<_CharT, _Traits, _Alloc>&
476 basic_string<_CharT, _Traits, _Alloc>::
477 _M_append(
const _CharT* __s, size_type __n)
479 const size_type __len = __n + this->
size();
481 if (__len <= this->capacity())
484 this->_S_copy(this->_M_data() + this->
size(), __s, __n);
487 this->_M_mutate(this->
size(), size_type(0), __s, __n);
489 this->_M_set_length(__len);
493 template<
typename _CharT,
typename _Traits,
typename _Alloc>
494 template<
typename _InputIterator>
496 basic_string<_CharT, _Traits, _Alloc>&
497 basic_string<_CharT, _Traits, _Alloc>::
498 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
499 _InputIterator __k1, _InputIterator __k2,
504 const basic_string __s(__k1, __k2, this->get_allocator());
505 const size_type __n1 = __i2 - __i1;
506 return _M_replace(__i1 -
begin(), __n1, __s._M_data(),
510 template<
typename _CharT,
typename _Traits,
typename _Alloc>
512 basic_string<_CharT, _Traits, _Alloc>&
513 basic_string<_CharT, _Traits, _Alloc>::
514 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
517 _M_check_length(__n1, __n2,
"basic_string::_M_replace_aux");
519 const size_type __old_size = this->
size();
520 const size_type __new_size = __old_size + __n2 - __n1;
522 if (__new_size <= this->capacity())
524 pointer __p = this->_M_data() + __pos1;
526 const size_type __how_much = __old_size - __pos1 - __n1;
527 if (__how_much && __n1 != __n2)
528 this->_S_move(__p + __n2, __p + __n1, __how_much);
531 this->_M_mutate(__pos1, __n1, 0, __n2);
534 this->_S_assign(this->_M_data() + __pos1, __n2, __c);
536 this->_M_set_length(__new_size);
540 template<
typename _CharT,
typename _Traits,
typename _Alloc>
541 __attribute__((__noinline__, __noclone__, __cold__))
void
542 basic_string<_CharT, _Traits, _Alloc>::
543 _M_replace_cold(pointer __p, size_type __len1,
const _CharT* __s,
544 const size_type __len2,
const size_type __how_much)
547 if (__len2 && __len2 <= __len1)
548 this->_S_move(__p, __s, __len2);
549 if (__how_much && __len1 != __len2)
550 this->_S_move(__p + __len2, __p + __len1, __how_much);
553 if (__s + __len2 <= __p + __len1)
554 this->_S_move(__p, __s, __len2);
555 else if (__s >= __p + __len1)
559 const size_type __poff = (__s - __p) + (__len2 - __len1);
560 this->_S_copy(__p, __p + __poff, __len2);
564 const size_type __nleft = (__p + __len1) - __s;
565 this->_S_move(__p, __s, __nleft);
566 this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft);
571 template<
typename _CharT,
typename _Traits,
typename _Alloc>
573 basic_string<_CharT, _Traits, _Alloc>&
574 basic_string<_CharT, _Traits, _Alloc>::
575 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
576 const size_type __len2)
578 _M_check_length(__len1, __len2,
"basic_string::_M_replace");
580 const size_type __old_size = this->
size();
581 const size_type __new_size = __old_size + __len2 - __len1;
583 if (__new_size <= this->capacity())
585 pointer __p = this->_M_data() + __pos;
587 const size_type __how_much = __old_size - __pos - __len1;
588 #if __cpp_lib_is_constant_evaluated
589 if (std::is_constant_evaluated())
591 auto __newp = _S_allocate(_M_get_allocator(), __new_size);
592 _S_copy(__newp, this->_M_data(), __pos);
593 _S_copy(__newp + __pos, __s, __len2);
594 _S_copy(__newp + __pos + __len2, __p + __len1, __how_much);
595 _S_copy(this->_M_data(), __newp, __new_size);
596 this->_M_get_allocator().deallocate(__newp, __new_size);
600 if (__builtin_expect(_M_disjunct(__s),
true))
602 if (__how_much && __len1 != __len2)
603 this->_S_move(__p + __len2, __p + __len1, __how_much);
605 this->_S_copy(__p, __s, __len2);
608 _M_replace_cold(__p, __len1, __s, __len2, __how_much);
611 this->_M_mutate(__pos, __len1, __s, __len2);
613 this->_M_set_length(__new_size);
617 template<
typename _CharT,
typename _Traits,
typename _Alloc>
619 typename basic_string<_CharT, _Traits, _Alloc>::size_type
621 copy(_CharT* __s, size_type __n, size_type __pos)
const
623 _M_check(__pos,
"basic_string::copy");
624 __n = _M_limit(__pos, __n);
625 __glibcxx_requires_string_len(__s, __n);
627 _S_copy(__s, _M_data() + __pos, __n);
632 #ifdef __glibcxx_string_resize_and_overwrite
633 template<
typename _CharT,
typename _Traits,
typename _Alloc>
634 template<
typename _Operation>
635 [[__gnu__::__always_inline__]]
639 { resize_and_overwrite<_Operation&>(__n, __op); }
642 #if __cplusplus >= 201103L
643 template<
typename _CharT,
typename _Traits,
typename _Alloc>
644 template<
typename _Operation>
645 _GLIBCXX20_CONSTEXPR
void
646 basic_string<_CharT, _Traits, _Alloc>::
647 #ifdef __glibcxx_string_resize_and_overwrite
648 resize_and_overwrite(
const size_type __n, _Operation __op)
650 __resize_and_overwrite(
const size_type __n, _Operation __op)
654 _CharT*
const __p = _M_data();
655 #if __cpp_lib_is_constant_evaluated
656 if (std::__is_constant_evaluated() && __n >
size())
657 traits_type::assign(__p +
size(), __n -
size(), _CharT());
660 _GLIBCXX20_CONSTEXPR ~_Terminator() { _M_this->_M_set_length(_M_r); }
661 basic_string* _M_this;
664 _Terminator __term{
this, 0};
665 auto __r =
std::move(__op)(__p + 0, __n + 0);
666 #ifdef __cpp_lib_concepts
667 static_assert(ranges::__detail::__is_integer_like<decltype(__r)>);
669 static_assert(__gnu_cxx::__is_integer_nonstrict<decltype(__r)>::__value,
670 "resize_and_overwrite operation must return an integer");
672 _GLIBCXX_DEBUG_ASSERT(__r >= 0 && size_type(__r) <= __n);
673 __term._M_r = size_type(__r);
674 if (__term._M_r > __n)
675 __builtin_unreachable();
681 #if __glibcxx_constexpr_string >= 201907L
682 # define _GLIBCXX_STRING_CONSTEXPR constexpr
684 # define _GLIBCXX_STRING_CONSTEXPR
686 template<
typename _CharT,
typename _Traits,
typename _Alloc>
687 _GLIBCXX_STRING_CONSTEXPR
688 typename basic_string<_CharT, _Traits, _Alloc>::size_type
690 find(
const _CharT* __s, size_type __pos, size_type __n)
const
693 __glibcxx_requires_string_len(__s, __n);
694 const size_type __size = this->
size();
697 return __pos <= __size ? __pos : npos;
701 const _CharT __elem0 = __s[0];
702 const _CharT*
const __data =
data();
703 const _CharT* __first = __data + __pos;
704 const _CharT*
const __last = __data + __size;
705 size_type __len = __size - __pos;
710 __first = traits_type::find(__first, __len - __n + 1, __elem0);
716 if (traits_type::compare(__first, __s, __n) == 0)
717 return __first - __data;
718 __len = __last - ++__first;
723 template<
typename _CharT,
typename _Traits,
typename _Alloc>
724 _GLIBCXX_STRING_CONSTEXPR
725 typename basic_string<_CharT, _Traits, _Alloc>::size_type
727 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
729 size_type __ret = npos;
730 const size_type __size = this->
size();
733 const _CharT* __data = _M_data();
734 const size_type __n = __size - __pos;
735 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
737 __ret = __p - __data;
742 template<
typename _CharT,
typename _Traits,
typename _Alloc>
743 _GLIBCXX_STRING_CONSTEXPR
744 typename basic_string<_CharT, _Traits, _Alloc>::size_type
746 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
749 __glibcxx_requires_string_len(__s, __n);
750 const size_type __size = this->
size();
753 __pos =
std::min(size_type(__size - __n), __pos);
754 const _CharT* __data = _M_data();
757 if (traits_type::compare(__data + __pos, __s, __n) == 0)
765 template<
typename _CharT,
typename _Traits,
typename _Alloc>
766 _GLIBCXX_STRING_CONSTEXPR
767 typename basic_string<_CharT, _Traits, _Alloc>::size_type
769 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
771 size_type __size = this->
size();
774 if (--__size > __pos)
776 for (++__size; __size-- > 0; )
777 if (traits_type::eq(_M_data()[__size], __c))
783 template<
typename _CharT,
typename _Traits,
typename _Alloc>
784 _GLIBCXX_STRING_CONSTEXPR
785 typename basic_string<_CharT, _Traits, _Alloc>::size_type
787 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
790 __glibcxx_requires_string_len(__s, __n);
791 for (; __n && __pos < this->
size(); ++__pos)
793 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
800 template<
typename _CharT,
typename _Traits,
typename _Alloc>
801 _GLIBCXX_STRING_CONSTEXPR
802 typename basic_string<_CharT, _Traits, _Alloc>::size_type
804 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
807 __glibcxx_requires_string_len(__s, __n);
808 size_type __size = this->
size();
811 if (--__size > __pos)
815 if (traits_type::find(__s, __n, _M_data()[__size]))
818 while (__size-- != 0);
823 template<
typename _CharT,
typename _Traits,
typename _Alloc>
824 _GLIBCXX_STRING_CONSTEXPR
825 typename basic_string<_CharT, _Traits, _Alloc>::size_type
830 __glibcxx_requires_string_len(__s, __n);
831 for (; __pos < this->
size(); ++__pos)
832 if (!traits_type::find(__s, __n, _M_data()[__pos]))
837 template<
typename _CharT,
typename _Traits,
typename _Alloc>
838 _GLIBCXX_STRING_CONSTEXPR
839 typename basic_string<_CharT, _Traits, _Alloc>::size_type
843 for (; __pos < this->
size(); ++__pos)
844 if (!traits_type::eq(_M_data()[__pos], __c))
849 template<
typename _CharT,
typename _Traits,
typename _Alloc>
850 _GLIBCXX_STRING_CONSTEXPR
851 typename basic_string<_CharT, _Traits, _Alloc>::size_type
856 __glibcxx_requires_string_len(__s, __n);
857 size_type __size = this->
size();
860 if (--__size > __pos)
864 if (!traits_type::find(__s, __n, _M_data()[__size]))
872 template<
typename _CharT,
typename _Traits,
typename _Alloc>
873 _GLIBCXX_STRING_CONSTEXPR
874 typename basic_string<_CharT, _Traits, _Alloc>::size_type
878 size_type __size = this->
size();
881 if (--__size > __pos)
885 if (!traits_type::eq(_M_data()[__size], __c))
893 #undef _GLIBCXX_STRING_CONSTEXPR
896 template<
typename _CharT,
typename _Traits,
typename _Alloc>
903 typedef typename __istream_type::ios_base __ios_base;
904 typedef typename __istream_type::int_type __int_type;
905 typedef typename __string_type::size_type __size_type;
907 typedef typename __ctype_type::ctype_base __ctype_base;
909 __size_type __extracted = 0;
910 typename __ios_base::iostate __err = __ios_base::goodbit;
911 typename __istream_type::sentry __cerb(__in,
false);
919 __size_type __len = 0;
921 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
923 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
924 const __int_type __eof = _Traits::eof();
925 __int_type __c = __in.
rdbuf()->sgetc();
927 while (__extracted < __n
928 && !_Traits::eq_int_type(__c, __eof)
929 && !__ct.is(__ctype_base::space,
930 _Traits::to_char_type(__c)))
932 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
934 __str.
append(__buf,
sizeof(__buf) /
sizeof(_CharT));
937 __buf[__len++] = _Traits::to_char_type(__c);
939 __c = __in.
rdbuf()->snextc();
941 __str.
append(__buf, __len);
943 if (__extracted < __n && _Traits::eq_int_type(__c, __eof))
944 __err |= __ios_base::eofbit;
949 __in._M_setstate(__ios_base::badbit);
950 __throw_exception_again;
957 __in._M_setstate(__ios_base::badbit);
962 __err |= __ios_base::failbit;
968 template<
typename _CharT,
typename _Traits,
typename _Alloc>
969 basic_istream<_CharT, _Traits>&
975 typedef typename __istream_type::ios_base __ios_base;
976 typedef typename __istream_type::int_type __int_type;
977 typedef typename __string_type::size_type __size_type;
979 __size_type __extracted = 0;
980 const __size_type __n = __str.
max_size();
981 typename __ios_base::iostate __err = __ios_base::goodbit;
982 typename __istream_type::sentry __cerb(__in,
true);
988 const __int_type __idelim = _Traits::to_int_type(__delim);
989 const __int_type __eof = _Traits::eof();
990 __int_type __c = __in.
rdbuf()->sgetc();
992 while (__extracted < __n
993 && !_Traits::eq_int_type(__c, __eof)
994 && !_Traits::eq_int_type(__c, __idelim))
996 __str += _Traits::to_char_type(__c);
998 __c = __in.
rdbuf()->snextc();
1001 if (_Traits::eq_int_type(__c, __eof))
1002 __err |= __ios_base::eofbit;
1003 else if (_Traits::eq_int_type(__c, __idelim))
1006 __in.
rdbuf()->sbumpc();
1009 __err |= __ios_base::failbit;
1013 __in._M_setstate(__ios_base::badbit);
1014 __throw_exception_again;
1021 __in._M_setstate(__ios_base::badbit);
1025 __err |= __ios_base::failbit;
1033 #if _GLIBCXX_EXTERN_TEMPLATE
1039 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
1040 extern template class basic_string<char>;
1041 # elif ! _GLIBCXX_USE_CXX11_ABI
1044 extern template basic_string<char>::size_type
1045 basic_string<char>::_Rep::_S_empty_rep_storage[];
1046 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
1048 extern template void
1049 basic_string<char>::_M_replace_cold(
char *, size_type,
const char*,
1050 const size_type,
const size_type);
1054 basic_istream<char>&
1057 basic_ostream<char>&
1058 operator<<(basic_ostream<char>&,
const string&);
1060 basic_istream<char>&
1061 getline(basic_istream<char>&,
string&,
char);
1063 basic_istream<char>&
1064 getline(basic_istream<char>&,
string&);
1066 #ifdef _GLIBCXX_USE_WCHAR_T
1067 # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0
1068 extern template class basic_string<wchar_t>;
1069 # elif ! _GLIBCXX_USE_CXX11_ABI
1070 extern template basic_string<wchar_t>::size_type
1071 basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];
1072 # elif _GLIBCXX_EXTERN_TEMPLATE > 0
1074 extern template void
1075 basic_string<wchar_t>::_M_replace_cold(
wchar_t*, size_type,
const wchar_t*,
1076 const size_type,
const size_type);
1080 basic_istream<wchar_t>&
1083 basic_ostream<wchar_t>&
1086 basic_istream<wchar_t>&
1089 basic_istream<wchar_t>&
1094 _GLIBCXX_END_NAMESPACE_VERSION
1097 #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.