33#ifndef _GLIBCXX_ISTREAM
34#define _GLIBCXX_ISTREAM 1
36#pragma GCC system_header
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
59 template<
typename _CharT,
typename _Traits>
64 typedef _CharT char_type;
65 typedef typename _Traits::int_type int_type;
66 typedef typename _Traits::pos_type pos_type;
67 typedef typename _Traits::off_type off_type;
68 typedef _Traits traits_type;
123 {
return __pf(*
this); }
171 {
return _M_extract(__n); }
178 {
return _M_extract(__n); }
185 {
return _M_extract(__n); }
189 {
return _M_extract(__n); }
193 {
return _M_extract(__n); }
195#ifdef _GLIBCXX_USE_LONG_LONG
198 {
return _M_extract(__n); }
202 {
return _M_extract(__n); }
217 {
return _M_extract(__f); }
221 {
return _M_extract(__f); }
225 {
return _M_extract(__f); }
228#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
229 __attribute__((__always_inline__))
234 __istream_type& __ret = _M_extract(__flt);
236 if (__flt < -__FLT16_MAX__)
238 __f = -__FLT16_MAX__;
241 else if (__flt > __FLT16_MAX__)
247 __f =
static_cast<_Float16
>(__flt);
254#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
255 __attribute__((__always_inline__))
260 __istream_type& __ret = _M_extract(__flt);
261 __f =
static_cast<_Float32
> (__flt);
266#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
267 __attribute__((__always_inline__))
272 __istream_type& __ret = _M_extract(__dbl);
273 __f =
static_cast<_Float64
> (__dbl);
278#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
279 __attribute__((__always_inline__))
284 __istream_type& __ret = _M_extract(__ldbl);
285 __f =
static_cast<_Float128
> (__ldbl);
290#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
291 __attribute__((__always_inline__))
296 __istream_type& __ret = _M_extract(__flt);
298 if (__flt < -__BFLT16_MAX__)
300 __f = -__BFLT16_MAX__;
303 else if (__flt > __BFLT16_MAX__)
305 __f = __BFLT16_MAX__;
309 __f =
static_cast<__gnu_cxx::__bfloat16_t
>(__flt);
326 {
return _M_extract(__p); }
445 {
return this->
get(__s, __n, this->
widen(
'\n')); }
467 get(__streambuf_type& __sb, char_type __delim);
478 {
return this->
get(__sb, this->
widen(
'\n')); }
692 seekg(off_type, ios_base::seekdir);
700#if __cplusplus >= 201103L
701 basic_istream(
const basic_istream&) =
delete;
703 basic_istream(basic_istream&& __rhs)
706 __ios_type::move(__rhs);
715 operator=(basic_istream&& __rhs)
722 swap(basic_istream& __rhs)
724 __ios_type::swap(__rhs);
729 template<
typename _ValueT>
731 _M_extract(_ValueT& __v);
750#ifdef _GLIBCXX_USE_WCHAR_T
775 template<
typename _CharT,
typename _Traits>
787 typedef typename _Traits::int_type __int_type;
821#if __cplusplus >= 201103L
824 operator bool()
const
840 template<
typename _CharT,
typename _Traits>
844 template<
class _Traits>
847 {
return (__in >>
reinterpret_cast<char&
>(__c)); }
849 template<
class _Traits>
850 inline basic_istream<char, _Traits>&
852 {
return (__in >>
reinterpret_cast<char&
>(__c)); }
856 template<
typename _CharT,
typename _Traits>
858 __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*,
streamsize);
889#if __cplusplus <= 201703L
890 template<
typename _CharT,
typename _Traits>
891 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
892 inline basic_istream<_CharT, _Traits>&
893 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
898 size_t __n = __builtin_object_size(__s, 0);
899 if (__n <
sizeof(_CharT))
902 __glibcxx_assert(__n >=
sizeof(_CharT));
907 else if (__n != (
size_t)-1)
909 __n /=
sizeof(_CharT);
911 std::__istream_extract(__in, __s, __n);
912 if (__in.good() && (__w <= 0 || __n < __w))
916 const typename _Traits::int_type __c = __in.rdbuf()->sgetc();
917 const bool __eof = _Traits::eq_int_type(__c, _Traits::eof());
918 if (__builtin_expect(__eof,
true))
926 streamsize __n = __gnu_cxx::__numeric_traits<streamsize>::__max;
927 __n /=
sizeof(_CharT);
928 std::__istream_extract(__in, __s, __n);
933 template<
class _Traits>
934 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
935 inline basic_istream<
char, _Traits>&
936 operator>>(basic_istream<
char, _Traits>& __in,
unsigned char* __s)
937 {
return __in >>
reinterpret_cast<char*
>(__s); }
939 template<
class _Traits>
940 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
941 inline basic_istream<
char, _Traits>&
942 operator>>(basic_istream<
char, _Traits>& __in,
signed char* __s)
943 {
return __in >>
reinterpret_cast<char*
>(__s); }
947 template<
typename _CharT,
typename _Traits,
size_t _Num>
948 inline basic_istream<_CharT, _Traits>&
951 static_assert(_Num <= __gnu_cxx::__numeric_traits<streamsize>::__max);
952 std::__istream_extract(__in, __s, _Num);
956 template<
class _Traits,
size_t _Num>
957 inline basic_istream<char, _Traits>&
959 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
961 template<
class _Traits,
size_t _Num>
962 inline basic_istream<char, _Traits>&
964 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
979 template<
typename _CharT,
typename _Traits>
988 typedef _CharT char_type;
989 typedef typename _Traits::int_type int_type;
990 typedef typename _Traits::pos_type pos_type;
991 typedef typename _Traits::off_type off_type;
992 typedef _Traits traits_type;
1016 : __istream_type(), __ostream_type() { }
1018#if __cplusplus >= 201103L
1019 basic_iostream(
const basic_iostream&) =
delete;
1021 basic_iostream(basic_iostream&& __rhs)
1022 : __istream_type(
std::move(__rhs)), __ostream_type(*this)
1030 operator=(basic_iostream&& __rhs)
1037 swap(basic_iostream& __rhs)
1038 { __istream_type::swap(__rhs); }
1062 template<
typename _CharT,
typename _Traits>
1063 basic_istream<_CharT, _Traits>&
1064 ws(basic_istream<_CharT, _Traits>& __is);
1066#if __cplusplus >= 201103L
1072#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
1073 template<
typename _Is,
typename _Tp>
1074 requires __derived_from_ios_base<_Is>
1075 &&
requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); }
1076 using __rvalue_stream_extraction_t = _Is&&;
1078 template<
typename _Is,
typename _Tp,
1079 typename = _Require_derived_from_ios_base<_Is>,
1080 typename =
decltype(std::declval<_Is&>() >> std::declval<_Tp>())>
1081 using __rvalue_stream_extraction_t = _Is&&;
1094 template<
typename _Istream,
typename _Tp>
1095 inline __rvalue_stream_extraction_t<_Istream, _Tp>
1098 __is >> std::forward<_Tp>(__x);
1103_GLIBCXX_END_NAMESPACE_VERSION
basic_istream< char > istream
Base class for char input streams.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
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.
Template class basic_ios, virtual base class for all stream classes.
void setstate(iostate __state)
Sets additional flags in the error state.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
char_type widen(char __c) const
Widens characters.
The actual work of input and output (interface).
Template class basic_istream.
__istream_type & operator>>(void *&__p)
Basic arithmetic extractors.
__istream_type & seekg(pos_type)
Changing the current read position.
streamsize gcount() const
Character counting.
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 & get(__streambuf_type &__sb)
Extraction into another streambuf.
__istream_type & operator>>(double &__f)
Floating point arithmetic extractors.
__istream_type & ignore()
Simple extraction.
__istream_type & operator>>(bool &__n)
Integer arithmetic extractors.
__istream_type & operator>>(long &__n)
Integer arithmetic extractors.
virtual ~basic_istream()
Base destructor.
__istream_type & getline(char_type *__s, streamsize __n)
String extraction.
__istream_type & operator>>(unsigned long long &__n)
Integer arithmetic extractors.
__istream_type & operator>>(float &__f)
Floating point arithmetic extractors.
__istream_type & operator>>(__ios_type &(*__pf)(__ios_type &))
Interface for manipulators.
__istream_type & operator>>(long long &__n)
Integer arithmetic extractors.
__istream_type & operator>>(unsigned long &__n)
Integer arithmetic extractors.
__istream_type & read(char_type *__s, streamsize __n)
Extraction without delimiters.
__istream_type & operator>>(unsigned int &__n)
Integer arithmetic extractors.
__istream_type & operator>>(unsigned short &__n)
Integer arithmetic extractors.
__istream_type & putback(char_type __c)
Unextracting a single character.
basic_istream(__streambuf_type *__sb)
Base constructor.
__istream_type & getline(char_type *__s, streamsize __n, char_type __delim)
String extraction.
__istream_type & get(char_type *__s, streamsize __n)
Simple multiple-character extraction.
__istream_type & operator>>(ios_base &(*__pf)(ios_base &))
Interface for manipulators.
__istream_type & operator>>(long double &__f)
Floating point arithmetic extractors.
__istream_type & operator>>(__istream_type &(*__pf)(__istream_type &))
Interface for manipulators.
int sync()
Synchronizing the stream buffer.
Template class basic_ostream.
Template class basic_iostream.
basic_iostream(basic_streambuf< _CharT, _Traits > *__sb)
Constructor does nothing.
virtual ~basic_iostream()
Destructor does nothing.
Performs setup work for input streams.
_Traits traits_type
Easy access to dependent types.
The base of the I/O class hierarchy.
_Ios_Iostate iostate
This is a bitmask type.
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 failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
Primary class template ctype facet.
Primary class template num_get.