46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
typename _CharT,
typename _Traits,
typename _Alloc>
51 _Rep::_S_max_size = (((npos -
sizeof(_Rep_base))/
sizeof(_CharT)) - 1) / 4;
53 template<
typename _CharT,
typename _Traits,
typename _Alloc>
56 _Rep::_S_terminal = _CharT();
58 template<
typename _CharT,
typename _Traits,
typename _Alloc>
64 template<
typename _CharT,
typename _Traits,
typename _Alloc>
67 (
sizeof(_Rep_base) +
sizeof(_CharT) +
sizeof(size_type) - 1) /
74 template<
typename _CharT,
typename _Traits,
typename _Alloc>
75 template<
typename _InIterator>
78 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
81 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
82 if (__beg == __end && __a == _Alloc())
83 return _S_empty_rep()._M_refdata();
88 while (__beg != __end && __len <
sizeof(__buf) /
sizeof(_CharT))
90 __buf[__len++] = *__beg;
93 _Rep* __r = _Rep::_S_create(__len, size_type(0), __a);
94 _M_copy(__r->_M_refdata(), __buf, __len);
97 while (__beg != __end)
99 if (__len == __r->_M_capacity)
102 _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);
103 _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len);
104 __r->_M_destroy(__a);
107 __r->_M_refdata()[__len++] = *__beg;
113 __r->_M_destroy(__a);
116 __r->_M_set_length_and_sharable(__len);
117 return __r->_M_refdata();
120 template<
typename _CharT,
typename _Traits,
typename _Alloc>
121 template <
typename _InIterator>
124 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
125 forward_iterator_tag)
127 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
128 if (__beg == __end && __a == _Alloc())
129 return _S_empty_rep()._M_refdata();
132 if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
133 __throw_logic_error(__N(
"basic_string::_S_construct null not valid"));
135 const size_type __dnew =
static_cast<size_type
>(std::distance(__beg,
138 _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
140 { _S_copy_chars(__r->_M_refdata(), __beg, __end); }
143 __r->_M_destroy(__a);
146 __r->_M_set_length_and_sharable(__dnew);
147 return __r->_M_refdata();
150 template<
typename _CharT,
typename _Traits,
typename _Alloc>
153 _S_construct(size_type __n, _CharT __c,
const _Alloc& __a)
155 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
156 if (__n == 0 && __a == _Alloc())
157 return _S_empty_rep()._M_refdata();
160 _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
162 _M_assign(__r->_M_refdata(), __n, __c);
164 __r->_M_set_length_and_sharable(__n);
165 return __r->_M_refdata();
168 template<
typename _CharT,
typename _Traits,
typename _Alloc>
171 : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()),
172 __str.get_allocator()),
173 __str.get_allocator())
176 template<
typename _CharT,
typename _Traits,
typename _Alloc>
179 : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)
182 template<
typename _CharT,
typename _Traits,
typename _Alloc>
185 : _M_dataplus(_S_construct(__str._M_data()
186 + __str._M_check(__pos,
187 "basic_string::basic_string"),
188 __str._M_data() + __str._M_limit(__pos, __n)
189 + __pos, _Alloc()), _Alloc())
192 template<
typename _CharT,
typename _Traits,
typename _Alloc>
195 size_type __n,
const _Alloc& __a)
196 : _M_dataplus(_S_construct(__str._M_data()
197 + __str._M_check(__pos,
198 "basic_string::basic_string"),
199 __str._M_data() + __str._M_limit(__pos, __n)
204 template<
typename _CharT,
typename _Traits,
typename _Alloc>
206 basic_string(
const _CharT* __s, size_type __n,
const _Alloc& __a)
207 : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)
211 template<
typename _CharT,
typename _Traits,
typename _Alloc>
214 : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :
215 __s + npos, __a), __a)
218 template<
typename _CharT,
typename _Traits,
typename _Alloc>
220 basic_string(size_type __n, _CharT __c,
const _Alloc& __a)
221 : _M_dataplus(_S_construct(__n, __c, __a), __a)
225 template<
typename _CharT,
typename _Traits,
typename _Alloc>
226 template<
typename _InputIterator>
228 basic_string(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a)
229 : _M_dataplus(_S_construct(__beg, __end, __a), __a)
232 #if __cplusplus >= 201103L
233 template<
typename _CharT,
typename _Traits,
typename _Alloc>
235 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a)
236 : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a)
240 template<
typename _CharT,
typename _Traits,
typename _Alloc>
245 if (_M_rep() != __str._M_rep())
248 const allocator_type __a = this->get_allocator();
249 _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());
250 _M_rep()->_M_dispose(__a);
256 template<
typename _CharT,
typename _Traits,
typename _Alloc>
259 assign(
const _CharT* __s, size_type __n)
262 _M_check_length(this->size(), __n,
"basic_string::assign");
263 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
264 return _M_replace_safe(size_type(0), this->size(), __s, __n);
268 const size_type __pos = __s - _M_data();
270 _M_copy(_M_data(), __s, __n);
272 _M_move(_M_data(), __s, __n);
273 _M_rep()->_M_set_length_and_sharable(__n);
278 template<
typename _CharT,
typename _Traits,
typename _Alloc>
281 append(size_type __n, _CharT __c)
285 _M_check_length(size_type(0), __n,
"basic_string::append");
286 const size_type __len = __n + this->size();
287 if (__len > this->capacity() || _M_rep()->_M_is_shared())
288 this->reserve(__len);
289 _M_assign(_M_data() + this->size(), __n, __c);
290 _M_rep()->_M_set_length_and_sharable(__len);
295 template<
typename _CharT,
typename _Traits,
typename _Alloc>
298 append(
const _CharT* __s, size_type __n)
303 _M_check_length(size_type(0), __n,
"basic_string::append");
304 const size_type __len = __n + this->size();
305 if (__len > this->capacity() || _M_rep()->_M_is_shared())
307 if (_M_disjunct(__s))
308 this->reserve(__len);
311 const size_type __off = __s - _M_data();
312 this->reserve(__len);
313 __s = _M_data() + __off;
316 _M_copy(_M_data() + this->size(), __s, __n);
317 _M_rep()->_M_set_length_and_sharable(__len);
322 template<
typename _CharT,
typename _Traits,
typename _Alloc>
327 const size_type
__size = __str.size();
330 const size_type __len = __size + this->size();
331 if (__len > this->capacity() || _M_rep()->_M_is_shared())
332 this->reserve(__len);
333 _M_copy(_M_data() + this->size(), __str._M_data(),
__size);
334 _M_rep()->_M_set_length_and_sharable(__len);
339 template<
typename _CharT,
typename _Traits,
typename _Alloc>
344 __str._M_check(__pos,
"basic_string::append");
345 __n = __str._M_limit(__pos, __n);
348 const size_type __len = __n + this->size();
349 if (__len > this->capacity() || _M_rep()->_M_is_shared())
350 this->reserve(__len);
351 _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n);
352 _M_rep()->_M_set_length_and_sharable(__len);
357 template<
typename _CharT,
typename _Traits,
typename _Alloc>
360 insert(size_type __pos,
const _CharT* __s, size_type __n)
363 _M_check(__pos,
"basic_string::insert");
364 _M_check_length(size_type(0), __n,
"basic_string::insert");
365 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
366 return _M_replace_safe(__pos, size_type(0), __s, __n);
370 const size_type __off = __s - _M_data();
371 _M_mutate(__pos, 0, __n);
372 __s = _M_data() + __off;
373 _CharT* __p = _M_data() + __pos;
374 if (__s + __n <= __p)
375 _M_copy(__p, __s, __n);
377 _M_copy(__p, __s + __n, __n);
380 const size_type __nleft = __p - __s;
381 _M_copy(__p, __s, __nleft);
382 _M_copy(__p + __nleft, __p + __n, __n - __nleft);
388 template<
typename _CharT,
typename _Traits,
typename _Alloc>
391 erase(iterator __first, iterator __last)
394 && __last <= _M_iend());
399 const size_type __size = __last - __first;
402 const size_type __pos = __first - _M_ibegin();
403 _M_mutate(__pos, __size, size_type(0));
404 _M_rep()->_M_set_leaked();
405 return iterator(_M_data() + __pos);
411 template<
typename _CharT,
typename _Traits,
typename _Alloc>
414 replace(size_type __pos, size_type __n1,
const _CharT* __s,
418 _M_check(__pos,
"basic_string::replace");
419 __n1 = _M_limit(__pos, __n1);
420 _M_check_length(__n1, __n2,
"basic_string::replace");
422 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
423 return _M_replace_safe(__pos, __n1, __s, __n2);
424 else if ((__left = __s + __n2 <= _M_data() + __pos)
425 || _M_data() + __pos + __n1 <= __s)
428 size_type __off = __s - _M_data();
429 __left ? __off : (__off += __n2 - __n1);
430 _M_mutate(__pos, __n1, __n2);
431 _M_copy(_M_data() + __pos, _M_data() + __off, __n2);
438 return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2);
442 template<
typename _CharT,
typename _Traits,
typename _Alloc>
447 const size_type __size =
sizeof(_Rep_base) +
448 (this->_M_capacity + 1) *
sizeof(_CharT);
449 _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(
this), __size);
452 template<
typename _CharT,
typename _Traits,
typename _Alloc>
457 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
458 if (_M_rep() == &_S_empty_rep())
461 if (_M_rep()->_M_is_shared())
463 _M_rep()->_M_set_leaked();
466 template<
typename _CharT,
typename _Traits,
typename _Alloc>
469 _M_mutate(size_type __pos, size_type __len1, size_type __len2)
471 const size_type __old_size = this->size();
472 const size_type __new_size = __old_size + __len2 - __len1;
473 const size_type __how_much = __old_size - __pos - __len1;
475 if (__new_size > this->capacity() || _M_rep()->_M_is_shared())
478 const allocator_type __a = get_allocator();
479 _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a);
482 _M_copy(__r->_M_refdata(), _M_data(), __pos);
484 _M_copy(__r->_M_refdata() + __pos + __len2,
485 _M_data() + __pos + __len1, __how_much);
487 _M_rep()->_M_dispose(__a);
488 _M_data(__r->_M_refdata());
490 else if (__how_much && __len1 != __len2)
493 _M_move(_M_data() + __pos + __len2,
494 _M_data() + __pos + __len1, __how_much);
496 _M_rep()->_M_set_length_and_sharable(__new_size);
499 template<
typename _CharT,
typename _Traits,
typename _Alloc>
504 if (__res != this->capacity() || _M_rep()->_M_is_shared())
507 if (__res < this->size())
508 __res = this->size();
509 const allocator_type __a = get_allocator();
510 _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());
511 _M_rep()->_M_dispose(__a);
516 template<
typename _CharT,
typename _Traits,
typename _Alloc>
521 if (_M_rep()->_M_is_leaked())
522 _M_rep()->_M_set_sharable();
523 if (__s._M_rep()->_M_is_leaked())
524 __s._M_rep()->_M_set_sharable();
525 if (this->get_allocator() == __s.get_allocator())
527 _CharT* __tmp = _M_data();
528 _M_data(__s._M_data());
535 __s.get_allocator());
536 const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),
537 this->get_allocator());
543 template<
typename _CharT,
typename _Traits,
typename _Alloc>
546 _S_create(size_type __capacity, size_type __old_capacity,
547 const _Alloc& __alloc)
551 if (__capacity > _S_max_size)
552 __throw_length_error(__N(
"basic_string::_S_create"));
577 const size_type __pagesize = 4096;
578 const size_type __malloc_header_size = 4 *
sizeof(
void*);
586 if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
587 __capacity = 2 * __old_capacity;
592 size_type __size = (__capacity + 1) *
sizeof(_CharT) +
sizeof(_Rep);
594 const size_type __adj_size = __size + __malloc_header_size;
595 if (__adj_size > __pagesize && __capacity > __old_capacity)
597 const size_type __extra = __pagesize - __adj_size % __pagesize;
598 __capacity += __extra /
sizeof(_CharT);
600 if (__capacity > _S_max_size)
601 __capacity = _S_max_size;
602 __size = (__capacity + 1) *
sizeof(_CharT) +
sizeof(_Rep);
607 void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);
608 _Rep *__p =
new (__place) _Rep;
609 __p->_M_capacity = __capacity;
617 __p->_M_set_sharable();
621 template<
typename _CharT,
typename _Traits,
typename _Alloc>
624 _M_clone(
const _Alloc& __alloc, size_type __res)
627 const size_type __requested_cap = this->_M_length + __res;
628 _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity,
631 _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length);
633 __r->_M_set_length_and_sharable(this->_M_length);
634 return __r->_M_refdata();
637 template<
typename _CharT,
typename _Traits,
typename _Alloc>
640 resize(size_type __n, _CharT __c)
642 const size_type __size = this->size();
643 _M_check_length(__size, __n,
"basic_string::resize");
645 this->append(__n - __size, __c);
646 else if (__n < __size)
651 template<
typename _CharT,
typename _Traits,
typename _Alloc>
652 template<
typename _InputIterator>
656 _InputIterator __k2, __false_type)
659 const size_type __n1 = __i2 - __i1;
660 _M_check_length(__n1, __s.size(),
"basic_string::_M_replace_dispatch");
661 return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(),
665 template<
typename _CharT,
typename _Traits,
typename _Alloc>
671 _M_check_length(__n1, __n2,
"basic_string::_M_replace_aux");
672 _M_mutate(__pos1, __n1, __n2);
674 _M_assign(_M_data() + __pos1, __n2, __c);
678 template<
typename _CharT,
typename _Traits,
typename _Alloc>
684 _M_mutate(__pos1, __n1, __n2);
686 _M_copy(_M_data() + __pos1, __s, __n2);
690 template<
typename _CharT,
typename _Traits,
typename _Alloc>
697 typedef typename __string_type::size_type __size_type;
698 const __size_type __len = _Traits::length(__lhs);
700 __str.reserve(__len + __rhs.size());
701 __str.append(__lhs, __len);
706 template<
typename _CharT,
typename _Traits,
typename _Alloc>
711 typedef typename __string_type::size_type __size_type;
713 const __size_type __len = __rhs.size();
714 __str.reserve(__len + 1);
715 __str.append(__size_type(1), __lhs);
720 template<
typename _CharT,
typename _Traits,
typename _Alloc>
723 copy(_CharT* __s, size_type __n, size_type __pos)
const
725 _M_check(__pos,
"basic_string::copy");
726 __n = _M_limit(__pos, __n);
729 _M_copy(__s, _M_data() + __pos, __n);
734 template<
typename _CharT,
typename _Traits,
typename _Alloc>
737 find(
const _CharT* __s, size_type __pos, size_type __n)
const
740 const size_type __size = this->size();
741 const _CharT* __data = _M_data();
744 return __pos <= __size ? __pos : npos;
748 for (; __pos <= __size - __n; ++__pos)
749 if (traits_type::eq(__data[__pos], __s[0])
750 && traits_type::compare(__data + __pos + 1,
751 __s + 1, __n - 1) == 0)
757 template<
typename _CharT,
typename _Traits,
typename _Alloc>
760 find(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
762 size_type __ret = npos;
763 const size_type __size = this->size();
766 const _CharT* __data = _M_data();
767 const size_type __n = __size - __pos;
768 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
770 __ret = __p - __data;
775 template<
typename _CharT,
typename _Traits,
typename _Alloc>
778 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
781 const size_type __size = this->size();
784 __pos =
std::min(size_type(__size - __n), __pos);
785 const _CharT* __data = _M_data();
788 if (traits_type::compare(__data + __pos, __s, __n) == 0)
796 template<
typename _CharT,
typename _Traits,
typename _Alloc>
799 rfind(_CharT __c, size_type __pos)
const _GLIBCXX_NOEXCEPT
801 size_type __size = this->size();
804 if (--__size > __pos)
806 for (++__size; __size-- > 0; )
807 if (traits_type::eq(_M_data()[__size], __c))
813 template<
typename _CharT,
typename _Traits,
typename _Alloc>
816 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
819 for (; __n && __pos < this->size(); ++__pos)
821 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
828 template<
typename _CharT,
typename _Traits,
typename _Alloc>
831 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
834 size_type __size = this->size();
837 if (--__size > __pos)
841 if (traits_type::find(__s, __n, _M_data()[__size]))
844 while (__size-- != 0);
849 template<
typename _CharT,
typename _Traits,
typename _Alloc>
855 for (; __pos < this->size(); ++__pos)
856 if (!traits_type::find(__s, __n, _M_data()[__pos]))
861 template<
typename _CharT,
typename _Traits,
typename _Alloc>
866 for (; __pos < this->size(); ++__pos)
867 if (!traits_type::eq(_M_data()[__pos], __c))
872 template<
typename _CharT,
typename _Traits,
typename _Alloc>
878 size_type __size = this->size();
881 if (--__size > __pos)
885 if (!traits_type::find(__s, __n, _M_data()[__size]))
893 template<
typename _CharT,
typename _Traits,
typename _Alloc>
898 size_type __size = this->size();
901 if (--__size > __pos)
905 if (!traits_type::eq(_M_data()[__size], __c))
913 template<
typename _CharT,
typename _Traits,
typename _Alloc>
918 _M_check(__pos,
"basic_string::compare");
919 __n = _M_limit(__pos, __n);
920 const size_type __osize = __str.size();
921 const size_type __len =
std::min(__n, __osize);
922 int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
924 __r = _S_compare(__n, __osize);
928 template<
typename _CharT,
typename _Traits,
typename _Alloc>
932 size_type __pos2, size_type __n2)
const
934 _M_check(__pos1,
"basic_string::compare");
935 __str._M_check(__pos2,
"basic_string::compare");
936 __n1 = _M_limit(__pos1, __n1);
937 __n2 = __str._M_limit(__pos2, __n2);
938 const size_type __len =
std::min(__n1, __n2);
939 int __r = traits_type::compare(_M_data() + __pos1,
940 __str.data() + __pos2, __len);
942 __r = _S_compare(__n1, __n2);
946 template<
typename _CharT,
typename _Traits,
typename _Alloc>
949 compare(
const _CharT* __s)
const
952 const size_type __size = this->size();
953 const size_type __osize = traits_type::length(__s);
954 const size_type __len =
std::min(__size, __osize);
955 int __r = traits_type::compare(_M_data(), __s, __len);
957 __r = _S_compare(__size, __osize);
961 template<
typename _CharT,
typename _Traits,
typename _Alloc>
964 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const
967 _M_check(__pos,
"basic_string::compare");
968 __n1 = _M_limit(__pos, __n1);
969 const size_type __osize = traits_type::length(__s);
970 const size_type __len =
std::min(__n1, __osize);
971 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
973 __r = _S_compare(__n1, __osize);
977 template<
typename _CharT,
typename _Traits,
typename _Alloc>
980 compare(size_type __pos, size_type __n1,
const _CharT* __s,
981 size_type __n2)
const
984 _M_check(__pos,
"basic_string::compare");
985 __n1 = _M_limit(__pos, __n1);
986 const size_type __len =
std::min(__n1, __n2);
987 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
989 __r = _S_compare(__n1, __n2);
994 template<
typename _CharT,
typename _Traits,
typename _Alloc>
995 basic_istream<_CharT, _Traits>&
996 operator>>(basic_istream<_CharT, _Traits>& __in,
999 typedef basic_istream<_CharT, _Traits> __istream_type;
1001 typedef typename __istream_type::ios_base __ios_base;
1002 typedef typename __istream_type::int_type __int_type;
1003 typedef typename __string_type::size_type __size_type;
1004 typedef ctype<_CharT> __ctype_type;
1005 typedef typename __ctype_type::ctype_base __ctype_base;
1007 __size_type __extracted = 0;
1008 typename __ios_base::iostate __err = __ios_base::goodbit;
1009 typename __istream_type::sentry __cerb(__in,
false);
1017 __size_type __len = 0;
1018 const streamsize __w = __in.width();
1019 const __size_type __n = __w > 0 ?
static_cast<__size_type
>(__w)
1021 const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
1022 const __int_type __eof = _Traits::eof();
1023 __int_type __c = __in.rdbuf()->sgetc();
1025 while (__extracted < __n
1026 && !_Traits::eq_int_type(__c, __eof)
1027 && !__ct.is(__ctype_base::space,
1028 _Traits::to_char_type(__c)))
1030 if (__len ==
sizeof(__buf) /
sizeof(_CharT))
1032 __str.append(__buf,
sizeof(__buf) /
sizeof(_CharT));
1035 __buf[__len++] = _Traits::to_char_type(__c);
1037 __c = __in.rdbuf()->snextc();
1039 __str.append(__buf, __len);
1041 if (_Traits::eq_int_type(__c, __eof))
1042 __err |= __ios_base::eofbit;
1045 __catch(__cxxabiv1::__forced_unwind&)
1047 __in._M_setstate(__ios_base::badbit);
1055 __in._M_setstate(__ios_base::badbit);
1060 __err |= __ios_base::failbit;
1062 __in.setstate(__err);
1066 template<
typename _CharT,
typename _Traits,
typename _Alloc>
1067 basic_istream<_CharT, _Traits>&
1068 getline(basic_istream<_CharT, _Traits>& __in,
1071 typedef basic_istream<_CharT, _Traits> __istream_type;
1073 typedef typename __istream_type::ios_base __ios_base;
1074 typedef typename __istream_type::int_type __int_type;
1075 typedef typename __string_type::size_type __size_type;
1077 __size_type __extracted = 0;
1078 const __size_type __n = __str.max_size();
1079 typename __ios_base::iostate __err = __ios_base::goodbit;
1080 typename __istream_type::sentry __cerb(__in,
true);
1086 const __int_type __idelim = _Traits::to_int_type(__delim);
1087 const __int_type __eof = _Traits::eof();
1088 __int_type __c = __in.rdbuf()->sgetc();
1090 while (__extracted < __n
1091 && !_Traits::eq_int_type(__c, __eof)
1092 && !_Traits::eq_int_type(__c, __idelim))
1094 __str += _Traits::to_char_type(__c);
1096 __c = __in.rdbuf()->snextc();
1099 if (_Traits::eq_int_type(__c, __eof))
1100 __err |= __ios_base::eofbit;
1101 else if (_Traits::eq_int_type(__c, __idelim))
1104 __in.rdbuf()->sbumpc();
1107 __err |= __ios_base::failbit;
1109 __catch(__cxxabiv1::__forced_unwind&)
1111 __in._M_setstate(__ios_base::badbit);
1119 __in._M_setstate(__ios_base::badbit);
1123 __err |= __ios_base::failbit;
1125 __in.setstate(__err);
1131 #if _GLIBCXX_EXTERN_TEMPLATE > 0
1134 basic_istream<char>&
1137 basic_ostream<char>&
1138 operator<<(basic_ostream<char>&,
const string&);
1140 basic_istream<char>&
1141 getline(basic_istream<char>&,
string&,
char);
1143 basic_istream<char>&
1144 getline(basic_istream<char>&,
string&);
1146 #ifdef _GLIBCXX_USE_WCHAR_T
1149 basic_istream<wchar_t>&
1150 operator>>(basic_istream<wchar_t>&, wstring&);
1152 basic_ostream<wchar_t>&
1153 operator<<(basic_ostream<wchar_t>&,
const wstring&);
1155 basic_istream<wchar_t>&
1156 getline(basic_istream<wchar_t>&, wstring&,
wchar_t);
1158 basic_istream<wchar_t>&
1159 getline(basic_istream<wchar_t>&, wstring&);
1163 _GLIBCXX_END_NAMESPACE_VERSION
std::size_t __size(__stack_t __stack)
Definition: profiler_node.h:68
#define __try
Definition: exception_defines.h:35
#define __throw_exception_again
Definition: exception_defines.h:37
#define __glibcxx_requires_string(_String)
Definition: debug.h:78
const _Tp & min(const _Tp &__a, const _Tp &__b)
Equivalent to std::min.
Definition: base.h:144
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Allocator > &__str)
Definition: string:1122
#define __glibcxx_requires_string_len(_String, _Len)
Definition: debug.h:79
_Safe_iterator< _Iterator, _Sequence > operator+(typename _Safe_iterator< _Iterator, _Sequence >::difference_type __n, const _Safe_iterator< _Iterator, _Sequence > &__i)
Definition: safe_iterator.h:712
#define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
Definition: debug.h:62
std::basic_istream< _CharT, _Traits > & getline(std::basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Allocator > &__str, _CharT __delim)
Definition: string:1132
#define __catch(X)
Definition: exception_defines.h:36
Definition: basic_string.h:45
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
Definition: exception_ptr.h:160