38#pragma GCC system_header
41#pragma GCC diagnostic push
42#pragma GCC diagnostic ignored "-Wc++11-extensions"
46namespace std _GLIBCXX_VISIBILITY(default)
48_GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _CharT,
typename _Traits>
61 if (!__noskip && bool(__in.flags() & ios_base::skipws))
63 const __int_type __eof = traits_type::eof();
64 __streambuf_type* __sb = __in.rdbuf();
65 __int_type __c = __sb->sgetc();
67 const __ctype_type& __ct = __check_facet(__in._M_ctype);
68 while (!traits_type::eq_int_type(__c, __eof)
69 && __ct.is(ctype_base::space,
70 traits_type::to_char_type(__c)))
76 if (traits_type::eq_int_type(__c, __eof))
77 __err |= ios_base::eofbit;
83 __throw_exception_again;
98 template<
typename _CharT,
typename _Traits>
99 template<
typename _ValueT>
100 basic_istream<_CharT, _Traits>&
101 basic_istream<_CharT, _Traits>::
102 _M_extract(_ValueT& __v)
104 sentry __cerb(*
this,
false);
110#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
111 const __num_get_type& __ng = __check_facet(this->_M_num_get);
113 const __num_get_type& __ng
116 __ng.get(*
this, 0, *
this, __err, __v);
118 __catch(__cxxabiv1::__forced_unwind&)
121 __throw_exception_again;
126 this->setstate(__err);
131 template<
typename _CharT,
typename _Traits>
138 sentry __cerb(*
this,
false);
145#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
146 const __num_get_type& __ng = __check_facet(this->_M_num_get);
148 const __num_get_type& __ng
151 __ng.
get(*
this, 0, *
this, __err, __l);
155 if (__l < __gnu_cxx::__numeric_traits<short>::__min)
158 __n = __gnu_cxx::__numeric_traits<short>::__min;
160 else if (__l > __gnu_cxx::__numeric_traits<short>::__max)
163 __n = __gnu_cxx::__numeric_traits<short>::__max;
171 __throw_exception_again;
181 template<
typename _CharT,
typename _Traits>
182 basic_istream<_CharT, _Traits>&
188 sentry __cerb(*
this,
false);
195#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
196 const __num_get_type& __ng = __check_facet(this->_M_num_get);
198 const __num_get_type& __ng
201 __ng.
get(*
this, 0, *
this, __err, __l);
205 if (__l < __gnu_cxx::__numeric_traits<int>::__min)
208 __n = __gnu_cxx::__numeric_traits<int>::__min;
210 else if (__l > __gnu_cxx::__numeric_traits<int>::__max)
213 __n = __gnu_cxx::__numeric_traits<int>::__max;
221 __throw_exception_again;
231 template<
typename _CharT,
typename _Traits>
237 sentry __cerb(*
this,
false);
238 if (__cerb && __sbout)
243 if (!__copy_streambufs_eof(this->
rdbuf(), __sbout, __ineof))
251 __throw_exception_again;
263 template<
typename _CharT,
typename _Traits>
264 typename basic_istream<_CharT, _Traits>::int_type
268 const int_type __eof = traits_type::eof();
269 int_type __c = __eof;
272 sentry __cerb(*
this,
true);
277 __c = this->
rdbuf()->sbumpc();
279 if (!traits_type::eq_int_type(__c, __eof))
287 __throw_exception_again;
299 template<
typename _CharT,
typename _Traits>
306 sentry __cerb(*
this,
true);
311 const int_type __cb = this->
rdbuf()->sbumpc();
313 if (!traits_type::eq_int_type(__cb, traits_type::eof()))
316 __c = traits_type::to_char_type(__cb);
324 __throw_exception_again;
336 template<
typename _CharT,
typename _Traits>
343 sentry __cerb(*
this,
true);
348 const int_type __idelim = traits_type::to_int_type(__delim);
349 const int_type __eof = traits_type::eof();
350 __streambuf_type* __sb = this->
rdbuf();
351 int_type __c = __sb->
sgetc();
354 && !traits_type::eq_int_type(__c, __eof)
355 && !traits_type::eq_int_type(__c, __idelim))
357 *__s++ = traits_type::to_char_type(__c);
361 if (traits_type::eq_int_type(__c, __eof))
367 __throw_exception_again;
379 this->setstate(__err);
383 template<
typename _CharT,
typename _Traits>
386 get(__streambuf_type& __sb, char_type __delim)
390 sentry __cerb(*
this,
true);
395 const int_type __idelim = traits_type::to_int_type(__delim);
396 const int_type __eof = traits_type::eof();
397 __streambuf_type* __this_sb = this->
rdbuf();
398 int_type __c = __this_sb->
sgetc();
399 char_type __c2 = traits_type::to_char_type(__c);
400#pragma GCC diagnostic push
401#pragma GCC diagnostic ignored "-Wlong-long"
402 unsigned long long __gcount = 0;
403#pragma GCC diagnostic pop
405 while (!traits_type::eq_int_type(__c, __eof)
406 && !traits_type::eq_int_type(__c, __idelim)
407 && !traits_type::eq_int_type(__sb.
sputc(__c2), __eof))
410 __c = __this_sb->
snextc();
411 __c2 = traits_type::to_char_type(__c);
413 if (traits_type::eq_int_type(__c, __eof))
417 if (__gcount <= __gnu_cxx::__numeric_traits<streamsize>::__max)
418 _M_gcount = __gcount;
420 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
425 __throw_exception_again;
433 this->setstate(__err);
437 template<
typename _CharT,
typename _Traits>
444 sentry __cerb(*
this,
true);
449 const int_type __idelim = traits_type::to_int_type(__delim);
450 const int_type __eof = traits_type::eof();
451 __streambuf_type* __sb = this->
rdbuf();
452 int_type __c = __sb->
sgetc();
455 && !traits_type::eq_int_type(__c, __eof)
456 && !traits_type::eq_int_type(__c, __idelim))
458 *__s++ = traits_type::to_char_type(__c);
462 if (traits_type::eq_int_type(__c, __eof))
466 if (traits_type::eq_int_type(__c, __idelim))
478 __throw_exception_again;
490 this->setstate(__err);
497 template<
typename _CharT,
typename _Traits>
503 sentry __cerb(*
this,
true);
509 const int_type __eof = traits_type::eof();
510 __streambuf_type* __sb = this->
rdbuf();
512 if (traits_type::eq_int_type(__sb->
sbumpc(), __eof))
520 __throw_exception_again;
525 this->setstate(__err);
530 template<
typename _CharT,
typename _Traits>
536 sentry __cerb(*
this,
true);
537 if (__cerb && __n > 0)
542 const int_type __eof = traits_type::eof();
543 __streambuf_type* __sb = this->
rdbuf();
544 int_type __c = __sb->
sgetc();
553 bool __large_ignore =
false;
557 && !traits_type::eq_int_type(__c, __eof))
562 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
563 && !traits_type::eq_int_type(__c, __eof))
566 __gnu_cxx::__numeric_traits<streamsize>::__min;
567 __large_ignore =
true;
573 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max)
576 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
578 if (traits_type::eq_int_type(__c, __eof))
583 if (traits_type::eq_int_type(__c, __eof))
590 __throw_exception_again;
595 this->setstate(__err);
600 template<
typename _CharT,
typename _Traits>
606 sentry __cerb(*
this,
true);
607 if (__cerb && __n > 0)
612 const int_type __eof = traits_type::eof();
613 __streambuf_type* __sb = this->
rdbuf();
614 int_type __c = __sb->
sgetc();
617 bool __large_ignore =
false;
621 && !traits_type::eq_int_type(__c, __eof)
622 && !traits_type::eq_int_type(__c, __delim))
627 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
628 && !traits_type::eq_int_type(__c, __eof)
629 && !traits_type::eq_int_type(__c, __delim))
632 __gnu_cxx::__numeric_traits<streamsize>::__min;
633 __large_ignore =
true;
639 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max)
642 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
644 if (traits_type::eq_int_type(__c, __eof))
648 if (_M_gcount != __n)
653 else if (_M_gcount < __n)
655 if (traits_type::eq_int_type(__c, __eof))
664 __catch(__cxxabiv1::__forced_unwind&)
667 __throw_exception_again;
672 this->setstate(__err);
677 template<
typename _CharT,
typename _Traits>
678 typename basic_istream<_CharT, _Traits>::int_type
682 int_type __c = traits_type::eof();
684 sentry __cerb(*
this,
true);
690 __c = this->
rdbuf()->sgetc();
691 if (traits_type::eq_int_type(__c, traits_type::eof()))
697 __throw_exception_again;
702 this->setstate(__err);
707 template<
typename _CharT,
typename _Traits>
713 sentry __cerb(*
this,
true);
726 __throw_exception_again;
736 template<
typename _CharT,
typename _Traits>
742 sentry __cerb(*
this,
true);
752 else if (__num == -1)
758 __throw_exception_again;
768 template<
typename _CharT,
typename _Traits>
778 sentry __cerb(*
this,
true);
784 const int_type __eof = traits_type::eof();
785 __streambuf_type* __sb = this->
rdbuf();
787 || traits_type::eq_int_type(__sb->
sputbackc(__c), __eof))
793 __throw_exception_again;
803 template<
typename _CharT,
typename _Traits>
813 sentry __cerb(*
this,
true);
819 const int_type __eof = traits_type::eof();
820 __streambuf_type* __sb = this->
rdbuf();
822 || traits_type::eq_int_type(__sb->
sungetc(), __eof))
828 __throw_exception_again;
833 this->setstate(__err);
838 template<
typename _CharT,
typename _Traits>
846 sentry __cerb(*
this,
true);
852 __streambuf_type* __sb = this->
rdbuf();
864 __throw_exception_again;
874 template<
typename _CharT,
typename _Traits>
875 typename basic_istream<_CharT, _Traits>::pos_type
881 pos_type __ret = pos_type(-1);
882 sentry __cerb(*
this,
true);
894 __throw_exception_again;
902 template<
typename _CharT,
typename _Traits>
905 seekg(pos_type __pos)
911 sentry __cerb(*
this,
true);
920 const pos_type __p = this->
rdbuf()->pubseekpos(__pos,
924 if (__p == pos_type(off_type(-1)))
931 __throw_exception_again;
941 template<
typename _CharT,
typename _Traits>
950 sentry __cerb(*
this,
true);
959 const pos_type __p = this->
rdbuf()->pubseekoff(__off, __dir,
963 if (__p == pos_type(off_type(-1)))
970 __throw_exception_again;
981 template<
typename _CharT,
typename _Traits>
986 typedef typename __istream_type::int_type __int_type;
988 typename __istream_type::sentry __cerb(__in,
false);
994 const __int_type __cb = __in.
rdbuf()->sbumpc();
995 if (!_Traits::eq_int_type(__cb, _Traits::eof()))
996 __c = _Traits::to_char_type(__cb);
1003 __throw_exception_again;
1013 template<
typename _CharT,
typename _Traits>
1015 __istream_extract(basic_istream<_CharT, _Traits>& __in, _CharT* __s,
1018 typedef basic_istream<_CharT, _Traits> __istream_type;
1019 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
1020 typedef typename _Traits::int_type int_type;
1021 typedef _CharT char_type;
1022 typedef ctype<_CharT> __ctype_type;
1026 typename __istream_type::sentry __cerb(__in,
false);
1033 if (0 < __width && __width < __num)
1038 const int_type __eof = _Traits::eof();
1039 __streambuf_type* __sb = __in.rdbuf();
1040 int_type __c = __sb->
sgetc();
1042 while (__extracted < __num - 1
1043 && !_Traits::eq_int_type(__c, __eof)
1044 && !__ct.is(ctype_base::space,
1045 _Traits::to_char_type(__c)))
1047 *__s++ = _Traits::to_char_type(__c);
1049 __c = __sb->snextc();
1052 if (__extracted < __num - 1
1053 && _Traits::eq_int_type(__c, __eof))
1061 __catch(__cxxabiv1::__forced_unwind&)
1064 __throw_exception_again;
1072 __in.setstate(__err);
1076 template<
typename _CharT,
typename _Traits>
1082 typedef typename __istream_type::int_type __int_type;
1087 typename __istream_type::sentry __cerb(__in,
true);
1094 const __int_type __eof = _Traits::eof();
1095 __streambuf_type* __sb = __in.
rdbuf();
1096 __int_type __c = __sb->sgetc();
1100 if (_Traits::eq_int_type(__c, __eof))
1105 if (!__ct.is(ctype_base::space, _Traits::to_char_type(__c)))
1107 __c = __sb->snextc();
1113 __throw_exception_again;
1127#if _GLIBCXX_EXTERN_TEMPLATE
1128#pragma GCC diagnostic push
1129#pragma GCC diagnostic ignored "-Wc++11-extensions"
1130#pragma GCC diagnostic ignored "-Wlong-long"
1131 extern template class basic_istream<char>;
1137 extern template istream& istream::_M_extract(
unsigned short&);
1138 extern template istream& istream::_M_extract(
unsigned int&);
1139 extern template istream& istream::_M_extract(
long&);
1140 extern template istream& istream::_M_extract(
unsigned long&);
1141 extern template istream& istream::_M_extract(
bool&);
1142#ifdef _GLIBCXX_USE_LONG_LONG
1143#pragma GCC diagnostic push
1144#pragma GCC diagnostic ignored "-Wlong-long"
1145 extern template istream& istream::_M_extract(
long long&);
1146 extern template istream& istream::_M_extract(
unsigned long long&);
1147#pragma GCC diagnostic pop
1149 extern template istream& istream::_M_extract(
float&);
1150 extern template istream& istream::_M_extract(
double&);
1151 extern template istream& istream::_M_extract(
long double&);
1152 extern template istream& istream::_M_extract(
void*&);
1154 extern template class basic_iostream<char>;
1156#ifdef _GLIBCXX_USE_WCHAR_T
1157 extern template class basic_istream<wchar_t>;
1162 extern template wistream& wistream::_M_extract(
unsigned short&);
1163 extern template wistream& wistream::_M_extract(
unsigned int&);
1164 extern template wistream& wistream::_M_extract(
long&);
1165 extern template wistream& wistream::_M_extract(
unsigned long&);
1166 extern template wistream& wistream::_M_extract(
bool&);
1167#ifdef _GLIBCXX_USE_LONG_LONG
1168 extern template wistream& wistream::_M_extract(
long long&);
1169 extern template wistream& wistream::_M_extract(
unsigned long long&);
1171 extern template wistream& wistream::_M_extract(
float&);
1172 extern template wistream& wistream::_M_extract(
double&);
1173 extern template wistream& wistream::_M_extract(
long double&);
1174 extern template wistream& wistream::_M_extract(
void*&);
1176 extern template class basic_iostream<wchar_t>;
1178#pragma GCC diagnostic pop
1181_GLIBCXX_END_NAMESPACE_VERSION
1184#pragma GCC diagnostic pop
basic_istream< char > istream
Base class for char input streams.
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
const _Facet & use_facet(const locale &__loc)
Return a facet.
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
basic_istream< _CharT, _Traits > & ws(basic_istream< _CharT, _Traits > &__is)
Quick and easy way to eat whitespace.
void clear(iostate __state=goodbit)
[Re]sets the error state.
void setstate(iostate __state)
iostate rdstate() const
Returns the error state of the stream buffer.
bool good() const
Fast error checking.
bool fail() const
Fast error checking.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
The actual work of input and output (interface).
int_type snextc()
Getting the next character.
int_type sbumpc()
Getting the next character.
int_type sungetc()
Moving backwards in the input stream.
int_type sgetc()
Getting the next character.
int pubsync()
Calls virtual sync function.
int_type sputbackc(char_type __c)
Pushing characters back into the input stream.
int_type sputc(char_type __c)
Entry point for all single-character output functions.
Template class basic_istream.
__istream_type & seekg(pos_type)
Changing the current read position.
int_type get()
Simple extraction.
streamsize readsome(char_type *__s, streamsize __n)
Extraction until the buffer is exhausted, but no more.
int_type peek()
Looking ahead in the stream.
__istream_type & unget()
Unextracting the previous character.
pos_type tellg()
Getting the current read position.
__istream_type & ignore()
Simple extraction.
__istream_type & read(char_type *__s, streamsize __n)
Extraction without delimiters.
__istream_type & putback(char_type __c)
Unextracting a single character.
basic_istream(__streambuf_type *__sb)
__istream_type & getline(char_type *__s, streamsize __n, char_type __delim)
String extraction.
__istream_type & operator>>(__istream_type &(*__pf)(__istream_type &))
Interface for manipulators.
int sync()
Synchronizing the stream buffer.
Performs setup work for input streams.
Thrown as part of forced unwinding.
_Ios_Iostate iostate
This is a bitmask type.
static const seekdir cur
Request a seek relative to the current position within the sequence.
static const openmode in
Open for input. Default for ifstream and fstream.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
static const iostate goodbit
Indicates all is well.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
_Ios_Seekdir seekdir
This is an enumerated type.
locale getloc() const
Locale access.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
Primary class template ctype facet.
iter_type get(iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, bool &__v) const
Numeric parsing.