33 #ifndef _GLIBCXX_ISTREAM
34 #define _GLIBCXX_ISTREAM 1
36 #pragma GCC system_header
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
57 template<
typename _CharT,
typename _Traits>
58 class basic_istream :
virtual public basic_ios<_CharT, _Traits>
62 typedef _CharT char_type;
63 typedef typename _Traits::int_type int_type;
64 typedef typename _Traits::pos_type pos_type;
65 typedef typename _Traits::off_type off_type;
66 typedef _Traits traits_type;
69 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
70 typedef basic_ios<_CharT, _Traits> __ios_type;
71 typedef basic_istream<_CharT, _Traits> __istream_type;
72 typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
74 typedef ctype<_CharT> __ctype_type;
121 {
return __pf(*
this); }
169 {
return _M_extract(__n); }
176 {
return _M_extract(__n); }
183 {
return _M_extract(__n); }
187 {
return _M_extract(__n); }
191 {
return _M_extract(__n); }
193 #ifdef _GLIBCXX_USE_LONG_LONG
196 {
return _M_extract(__n); }
200 {
return _M_extract(__n); }
215 {
return _M_extract(__f); }
219 {
return _M_extract(__f); }
223 {
return _M_extract(__f); }
236 {
return _M_extract(__p); }
343 get(char_type* __s,
streamsize __n, char_type __delim);
355 {
return this->
get(__s, __n, this->
widen(
'\n')); }
377 get(__streambuf_type& __sb, char_type __delim);
388 {
return this->
get(__sb, this->
widen(
'\n')); }
602 seekg(off_type, ios_base::seekdir);
610 #if __cplusplus >= 201103L
611 basic_istream(
const basic_istream&) =
delete;
613 basic_istream(basic_istream&& __rhs)
616 __ios_type::move(__rhs);
625 operator=(basic_istream&& __rhs)
632 swap(basic_istream& __rhs)
634 __ios_type::swap(__rhs);
639 template<
typename _ValueT>
641 _M_extract(_ValueT& __v);
660 #ifdef _GLIBCXX_USE_WCHAR_T
662 basic_istream<wchar_t>&
667 basic_istream<wchar_t>&
672 basic_istream<wchar_t>&
685 template<
typename _CharT,
typename _Traits>
697 typedef typename _Traits::int_type __int_type;
731 #if __cplusplus >= 201103L
734 operator bool()
const
750 template<
typename _CharT,
typename _Traits>
754 template<
class _Traits>
757 {
return (__in >> reinterpret_cast<char&>(__c)); }
759 template<
class _Traits>
760 inline basic_istream<char, _Traits>&
762 {
return (__in >> reinterpret_cast<char&>(__c)); }
766 template<
typename _CharT,
typename _Traits>
768 __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*,
streamsize);
799 #if __cplusplus <= 201703L
800 template<
typename _CharT,
typename _Traits>
801 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
802 inline basic_istream<_CharT, _Traits>&
803 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
808 size_t __n = __builtin_object_size(__s, 0);
809 if (__n <
sizeof(_CharT))
812 __glibcxx_assert(__n >=
sizeof(_CharT));
817 else if (__n != (
size_t)-1)
819 __n /=
sizeof(_CharT);
821 std::__istream_extract(__in, __s, __n);
822 if (__in.good() && (__w <= 0 || __n < __w))
826 const typename _Traits::int_type __c = __in.rdbuf()->sgetc();
827 const bool __eof = _Traits::eq_int_type(__c, _Traits::eof());
828 if (__builtin_expect(__eof,
true))
836 streamsize __n = __gnu_cxx::__numeric_traits<streamsize>::__max;
837 __n /=
sizeof(_CharT);
838 std::__istream_extract(__in, __s, __n);
843 template<
class _Traits>
844 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
845 inline basic_istream<
char, _Traits>&
846 operator>>(basic_istream<
char, _Traits>& __in,
unsigned char* __s)
847 {
return __in >>
reinterpret_cast<char*
>(__s); }
849 template<
class _Traits>
850 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
851 inline basic_istream<
char, _Traits>&
852 operator>>(basic_istream<
char, _Traits>& __in,
signed char* __s)
853 {
return __in >>
reinterpret_cast<char*
>(__s); }
857 template<
typename _CharT,
typename _Traits,
size_t _Num>
858 inline basic_istream<_CharT, _Traits>&
861 static_assert(_Num <= __gnu_cxx::__numeric_traits<streamsize>::__max);
862 std::__istream_extract(__in, __s, _Num);
866 template<
class _Traits,
size_t _Num>
867 inline basic_istream<char, _Traits>&
869 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
871 template<
class _Traits,
size_t _Num>
872 inline basic_istream<char, _Traits>&
874 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
889 template<
typename _CharT,
typename _Traits>
891 :
public basic_istream<_CharT, _Traits>,
892 public basic_ostream<_CharT, _Traits>
898 typedef _CharT char_type;
899 typedef typename _Traits::int_type int_type;
900 typedef typename _Traits::pos_type pos_type;
901 typedef typename _Traits::off_type off_type;
902 typedef _Traits traits_type;
905 typedef basic_istream<_CharT, _Traits> __istream_type;
906 typedef basic_ostream<_CharT, _Traits> __ostream_type;
926 : __istream_type(), __ostream_type() { }
928 #if __cplusplus >= 201103L
929 basic_iostream(
const basic_iostream&) =
delete;
931 basic_iostream(basic_iostream&& __rhs)
932 : __istream_type(std::move(__rhs)), __ostream_type(*this)
940 operator=(basic_iostream&& __rhs)
947 swap(basic_iostream& __rhs)
948 { __istream_type::swap(__rhs); }
972 template<
typename _CharT,
typename _Traits>
973 basic_istream<_CharT, _Traits>&
974 ws(basic_istream<_CharT, _Traits>& __is);
976 #if __cplusplus >= 201103L
982 #if __cpp_lib_concepts
983 template<
typename _Is,
typename _Tp>
984 requires __derived_from_ios_base<_Is>
985 && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
986 using __rvalue_stream_extraction_t = _Is&&;
988 template<
typename _Is,
typename _Tp,
989 typename = _Require_derived_from_ios_base<_Is>,
990 typename = decltype(std::declval<_Is&>() >> std::declval<_Tp>())>
991 using __rvalue_stream_extraction_t = _Is&&;
1004 template<
typename _Istream,
typename _Tp>
1005 inline __rvalue_stream_extraction_t<_Istream, _Tp>
1008 __is >> std::forward<_Tp>(__x);
1013 _GLIBCXX_END_NAMESPACE_VERSION
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
int sync()
Synchronizing the stream buffer.
basic_istream< _CharT, _Traits > & ws(basic_istream< _CharT, _Traits > &__is)
Quick and easy way to eat whitespace.
Template class basic_iostream.
streamsize readsome(char_type *__s, streamsize __n)
Extraction until the buffer is exhausted, but no more.
int_type peek()
Looking ahead in the stream.
_Traits traits_type
Easy access to dependent types.
virtual ~basic_iostream()
Destructor does nothing.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
__istream_type & operator>>(long double &__f)
Floating point arithmetic extractors.
Primary class template ctype facet.This template class defines classification and conversion function...
basic_istream< char > istream
Base class for char input streams.
__istream_type & operator>>(float &__f)
Floating point arithmetic extractors.
__istream_type & operator>>(double &__f)
Floating point arithmetic extractors.
__istream_type & read(char_type *__s, streamsize __n)
Extraction without delimiters.
__istream_type & operator>>(unsigned long long &__n)
Integer arithmetic extractors.
__istream_type & getline(char_type *__s, streamsize __n)
String extraction.
Performs setup work for input streams.
__istream_type & operator>>(ios_base &(*__pf)(ios_base &))
Interface for manipulators.
__istream_type & operator>>(__istream_type &(*__pf)(__istream_type &))
Interface for manipulators.
__istream_type & seekg(pos_type)
Changing the current read position.
basic_istream(__streambuf_type *__sb)
Base constructor.
streamsize gcount() const
Character counting.
__istream_type & ignore()
Simple extraction.
__istream_type & operator>>(unsigned int &__n)
Integer arithmetic extractors.
__istream_type & operator>>(void *&__p)
Basic arithmetic extractors.
__istream_type & operator>>(bool &__n)
Integer arithmetic extractors.
__istream_type & unget()
Unextracting the previous character.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
basic_iostream(basic_streambuf< _CharT, _Traits > *__sb)
Constructor does nothing.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
pos_type tellg()
Getting the current read position.
__istream_type & operator>>(unsigned short &__n)
Integer arithmetic extractors.
__istream_type & putback(char_type __c)
Unextracting a single character.
__istream_type & getline(char_type *__s, streamsize __n, char_type __delim)
String extraction.
__istream_type & operator>>(unsigned long &__n)
Integer arithmetic extractors.
virtual ~basic_istream()
Base destructor.
__istream_type & operator>>(__ios_type &(*__pf)(__ios_type &))
Interface for manipulators.
char_type widen(char __c) const
Widens characters.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
__istream_type & operator>>(long &__n)
Integer arithmetic extractors.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
__istream_type & operator>>(long long &__n)
Integer arithmetic extractors.