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
196#pragma GCC diagnostic push
197#pragma GCC diagnostic ignored "-Wlong-long"
200 {
return _M_extract(__n); }
204 {
return _M_extract(__n); }
205#pragma GCC diagnostic pop
220 {
return _M_extract(__f); }
224 {
return _M_extract(__f); }
228 {
return _M_extract(__f); }
231#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
232 __attribute__((__always_inline__))
237 __istream_type& __ret = _M_extract(__flt);
239 if (__flt < -__FLT16_MAX__)
241 __f = -__FLT16_MAX__;
244 else if (__flt > __FLT16_MAX__)
250 __f =
static_cast<_Float16
>(__flt);
257#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
258 __attribute__((__always_inline__))
263 __istream_type& __ret = _M_extract(__flt);
264 __f =
static_cast<_Float32
> (__flt);
269#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
270 __attribute__((__always_inline__))
275 __istream_type& __ret = _M_extract(__dbl);
276 __f =
static_cast<_Float64
> (__dbl);
281#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
282 __attribute__((__always_inline__))
287 __istream_type& __ret = _M_extract(__ldbl);
288 __f =
static_cast<_Float128
> (__ldbl);
293#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
294 __attribute__((__always_inline__))
299 __istream_type& __ret = _M_extract(__flt);
301 if (__flt < -__BFLT16_MAX__)
303 __f = -__BFLT16_MAX__;
306 else if (__flt > __BFLT16_MAX__)
308 __f = __BFLT16_MAX__;
312 __f =
static_cast<__gnu_cxx::__bfloat16_t
>(__flt);
329 {
return _M_extract(__p); }
448 {
return this->
get(__s, __n, this->
widen(
'\n')); }
470 get(__streambuf_type& __sb, char_type __delim);
480 get(__streambuf_type& __sb)
481 {
return this->
get(__sb, this->
widen(
'\n')); }
703#if __cplusplus >= 201103L
709 __ios_type::move(__rhs);
727 __ios_type::swap(__rhs);
732 template<
typename _ValueT>
734 _M_extract(_ValueT& __v);
753#ifdef _GLIBCXX_USE_WCHAR_T
778 template<
typename _CharT,
typename _Traits>
789 typedef typename __istream_type::__ctype_type __ctype_type;
790 typedef typename _Traits::int_type __int_type;
824#if __cplusplus >= 201103L
827 operator bool()
const
843 template<
typename _CharT,
typename _Traits>
847 template<
class _Traits>
850 {
return (__in >>
reinterpret_cast<char&
>(__c)); }
852 template<
class _Traits>
853 inline basic_istream<char, _Traits>&
855 {
return (__in >>
reinterpret_cast<char&
>(__c)); }
859 template<
typename _CharT,
typename _Traits>
861 __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*,
streamsize);
892#if __cplusplus <= 201703L
893 template<
typename _CharT,
typename _Traits>
894 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
895 inline basic_istream<_CharT, _Traits>&
896 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
901 size_t __n = __builtin_object_size(__s, 0);
902 if (__n <
sizeof(_CharT))
905 __glibcxx_assert(__n >=
sizeof(_CharT));
910 else if (__n != (
size_t)-1)
912 __n /=
sizeof(_CharT);
914 std::__istream_extract(__in, __s, __n);
915 if (__in.good() && (__w <= 0 || __n < (
size_t)__w))
919 const typename _Traits::int_type __c = __in.rdbuf()->sgetc();
920 const bool __eof = _Traits::eq_int_type(__c, _Traits::eof());
921 if (__builtin_expect(__eof,
true))
929 streamsize __n = __gnu_cxx::__numeric_traits<streamsize>::__max;
930 __n /=
sizeof(_CharT);
931 std::__istream_extract(__in, __s, __n);
936 template<
class _Traits>
937 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
939 operator>>(
basic_istream<
char, _Traits>& __in,
unsigned char* __s)
940 {
return __in >>
reinterpret_cast<char*
>(__s); }
942 template<
class _Traits>
943 __attribute__((__nonnull__(2), __access__(__write_only__, 2)))
945 operator>>(
basic_istream<
char, _Traits>& __in,
signed char* __s)
946 {
return __in >>
reinterpret_cast<char*
>(__s); }
950 template<
typename _CharT,
typename _Traits,
size_t _Num>
954 static_assert(_Num <= __gnu_cxx::__numeric_traits<streamsize>::__max);
955 std::__istream_extract(__in, __s, _Num);
959 template<
class _Traits,
size_t _Num>
960 inline basic_istream<char, _Traits>&
962 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
964 template<
class _Traits,
size_t _Num>
965 inline basic_istream<char, _Traits>&
967 {
return __in >>
reinterpret_cast<char(&)[_Num]
>(__s); }
982 template<
typename _CharT,
typename _Traits>
991 typedef _CharT char_type;
992 typedef typename _Traits::int_type int_type;
993 typedef typename _Traits::pos_type pos_type;
994 typedef typename _Traits::off_type off_type;
995 typedef _Traits traits_type;
1009 : __istream_type(__sb), __ostream_type(__sb) { }
1019 : __istream_type(), __ostream_type() { }
1021#if __cplusplus >= 201103L
1025 : __istream_type(
std::move(__rhs)), __ostream_type(*this)
1041 { __istream_type::swap(__rhs); }
1065 template<
typename _CharT,
typename _Traits>
1069#if __cplusplus >= 201103L
1075#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
1076 template<
typename _Is,
typename _Tp>
1077 requires __derived_from_ios_base<_Is>
1079 using __rvalue_stream_extraction_t = _Is&&;
1081 template<
typename _Is,
typename _Tp,
1082 typename = _Require_derived_from_ios_base<_Is>,
1084 using __rvalue_stream_extraction_t = _Is&&;
1097 template<
typename _Istream,
typename _Tp>
1098 inline __rvalue_stream_extraction_t<_Istream, _Tp>
1106_GLIBCXX_END_NAMESPACE_VERSION
basic_istream< char > istream
Base class for char input streams.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
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 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.
basic_ios(basic_streambuf< _CharT, _Traits > *__sb)
Constructor performs initialization.
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.
__istream_type & get(__streambuf_type &__sb, char_type __delim)
Extraction into another streambuf.
int_type peek()
Looking ahead in the stream.
__istream_type & ignore(streamsize __n, int_type __delim)
Discarding characters.
__istream_type & operator>>(__streambuf_type *__sb)
Extracting into another streambuf.
__istream_type & unget()
Unextracting the previous character.
pos_type tellg()
Getting the current read position.
__istream_type & operator>>(int &__n)
Integer arithmetic extractors.
__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.
__istream_type & get(char_type &__c)
Simple extraction.
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 & seekg(off_type, ios_base::seekdir)
Changing the current read position.
__istream_type & getline(char_type *__s, streamsize __n, char_type __delim)
String extraction.
__istream_type & get(char_type *__s, streamsize __n, char_type __delim)
Simple multiple-character 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.
__istream_type & operator>>(short &__n)
Integer arithmetic extractors.
__istream_type & ignore(streamsize __n)
Simple extraction.
basic_ostream(__streambuf_type *__sb)
Base constructor.
basic_iostream(basic_streambuf< _CharT, _Traits > *__sb)
Constructor does nothing.
virtual ~basic_iostream()
Destructor does nothing.
sentry(basic_istream< _CharT, _Traits > &__is, bool __noskipws=false)
The constructor performs all the work.
_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.
_Ios_Seekdir seekdir
This is an enumerated type.
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.