libstdc++
std::basic_istream< _CharT, _Traits > Class Template Reference
Inheritance diagram for std::basic_istream< _CharT, _Traits >:
[legend]

Classes

class  sentry
 

Public Types

typedef ctype< _CharT > __ctype_type
 
typedef basic_ios< _CharT, _Traits > __ios_type
 
typedef basic_istream< _CharT, _Traits > __istream_type
 
typedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_type
 
typedef basic_streambuf< _CharT, _Traits > __streambuf_type
 
typedef _CharT char_type
 
typedef _Traits::int_type int_type
 
typedef _Traits::off_type off_type
 
typedef _Traits::pos_type pos_type
 
typedef _Traits traits_type
 

Public Member Functions

 basic_istream (__streambuf_type *__sb)
 
virtual ~basic_istream ()
 
template<typename _ValueT >
basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)
 
basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)
 
basic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)
 
basic_istream< char > & ignore (streamsize __n)
 
basic_istream< wchar_t > & ignore (streamsize __n)
 
basic_istream< char > & ignore (streamsize __n, int_type __delim)
 
basic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)
 
__istream_typeoperator>> (__ios_type &(*__pf)(__ios_type &))
 
__istream_typeoperator>> (__istream_type &(*__pf)(__istream_type &))
 
__istream_typeoperator>> (ios_base &(*__pf)(ios_base &))
 

Protected Attributes

streamsize _M_gcount
 

Friends

class sentry
 

Unformatted Input Functions

All the unformatted input functions have some common behavior. Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.

If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.

The number of characters extracted is stored for later retrieval by gcount().

If an exception is thrown during extraction, ios_base::badbit will be turned on in the stream's error state (without causing an ios_base::failure to be thrown) and the original exception will be rethrown if badbit is set in the exceptions mask.

int_type get ()
 
__istream_typeget (char_type &__c)
 
__istream_typeget (char_type *__s, streamsize __n, char_type __delim)
 
__istream_typeget (char_type *__s, streamsize __n)
 
__istream_typeget (__streambuf_type &__sb, char_type __delim)
 
__istream_typeget (__streambuf_type &__sb)
 
__istream_typegetline (char_type *__s, streamsize __n, char_type __delim)
 
__istream_typegetline (char_type *__s, streamsize __n)
 
__istream_typeignore (streamsize __n, int_type __delim)
 
__istream_typeignore (streamsize __n)
 
__istream_typeignore ()
 
int_type peek ()
 
__istream_typeread (char_type *__s, streamsize __n)
 
streamsize readsome (char_type *__s, streamsize __n)
 
__istream_typeputback (char_type __c)
 
__istream_typeunget ()
 
int sync ()
 
pos_type tellg ()
 
__istream_typeseekg (pos_type)
 
__istream_typeseekg (off_type, ios_base::seekdir)
 
 basic_istream ()
 
 basic_istream (const basic_istream &)=delete
 
 basic_istream (basic_istream &&__rhs)
 
basic_istreamoperator= (const basic_istream &)=delete
 
basic_istreamoperator= (basic_istream &&__rhs)
 
void swap (basic_istream &__rhs)
 
template<typename _ValueT >
__istream_type_M_extract (_ValueT &__v)
 

Detailed Description

template<typename _CharT, typename _Traits>
class std::basic_istream< _CharT, _Traits >

Template class basic_istream.

Template Parameters
_CharTType of character stream.
_TraitsTraits for character type, defaults to char_traits<_CharT>.

This is the base class for all input streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual input.

Definition at line 83 of file iosfwd.

Constructor & Destructor Documentation

◆ basic_istream() [1/4]

template<typename _CharT , typename _Traits >
std::basic_istream< _CharT, _Traits >::basic_istream ( __streambuf_type __sb)
inlineexplicit

Base constructor.

This ctor is almost never called by the user directly, rather from derived classes' initialization lists, which pass a pointer to their own stream buffer.

Definition at line 93 of file istream.

◆ ~basic_istream()

template<typename _CharT , typename _Traits >
virtual std::basic_istream< _CharT, _Traits >::~basic_istream ( )
inlinevirtual

Base destructor.

This does very little apart from providing a virtual base dtor.

Definition at line 103 of file istream.

◆ basic_istream() [2/4]

template<typename _CharT , typename _Traits >
std::basic_istream< _CharT, _Traits >::basic_istream ( )
inlineprotected

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 606 of file istream.

◆ basic_istream() [3/4]

template<typename _CharT , typename _Traits >
std::basic_istream< _CharT, _Traits >::basic_istream ( const basic_istream< _CharT, _Traits > &  )
protecteddelete

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

◆ basic_istream() [4/4]

template<typename _CharT , typename _Traits >
std::basic_istream< _CharT, _Traits >::basic_istream ( basic_istream< _CharT, _Traits > &&  __rhs)
inlineprotected

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 613 of file istream.

Member Function Documentation

◆ _M_extract()

template<typename _CharT , typename _Traits >
template<typename _ValueT >
__istream_type& std::basic_istream< _CharT, _Traits >::_M_extract ( _ValueT &  __v)
protected

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

◆ gcount()

template<typename _CharT , typename _Traits >
streamsize std::basic_istream< _CharT, _Traits >::gcount ( ) const
inline

Character counting.

Returns
The number of characters extracted by the previous unformatted input function dispatched for this stream.

Definition at line 269 of file istream.

◆ get() [1/6]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::get

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 243 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ get() [2/6]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::get ( __streambuf_type __sb)
inline

Extraction into another streambuf.

Parameters
__sbA streambuf in which to store data.
Returns
*this

Returns get(__sb,widen('\n')).

Definition at line 387 of file istream.

◆ get() [3/6]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get ( __streambuf_type __sb,
char_type  __delim 
)

Extraction into another streambuf.

Parameters
__sbA streambuf in which to store data.
__delimA "stop" character.
Returns
*this

Characters are extracted and inserted into __sb until one of the following happens:

  • the input sequence reaches EOF
  • insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted)
  • the next character equals __delim (in this case, the character is not extracted)
  • an exception occurs (and in this case is caught)

If no characters are stored, failbit is set in the stream's error state.

Definition at line 363 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ get() [4/6]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get ( char_type &  __c)

Simple extraction.

Parameters
__cThe character in which to store data.
Returns
*this

Tries to extract a character and store it in __c. If none are available, sets failbit and returns traits::eof().

Note
This function is not overloaded on signed char and unsigned char.

Definition at line 279 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ get() [5/6]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::get ( char_type *  __s,
streamsize  __n 
)
inline

Simple multiple-character extraction.

Parameters
__sPointer to an array.
__nMaximum number of characters to store in s.
Returns
*this

Returns get(__s,__n,widen('\n')).

Definition at line 354 of file istream.

◆ get() [6/6]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get ( char_type *  __s,
streamsize  __n,
char_type  __delim 
)

Simple multiple-character extraction.

Parameters
__sPointer to an array.
__nMaximum number of characters to store in __s.
__delimA "stop" character.
Returns
*this

Characters are extracted and stored into __s until one of the following happens:

  • __n-1 characters are stored
  • the input sequence reaches EOF
  • the next character equals __delim, in which case the character is not extracted

If no characters are stored, failbit is set in the stream's error state.

In any case, a null character is stored into the next location in the array.

Note
This function is not overloaded on signed char and unsigned char.

Definition at line 316 of file istream.tcc.

◆ getline() [1/3]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::getline ( char_type *  __s,
streamsize  __n 
)
inline

String extraction.

Parameters
__sA character array in which to store the data.
__nMaximum number of characters to extract.
Returns
*this

Returns getline(__s,__n,widen('\n')).

Definition at line 427 of file istream.

◆ getline() [2/3]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::getline ( char_type *  __s,
streamsize  __n,
char_type  __delim 
)

String extraction.

Parameters
__sA character array in which to store the data.
__nMaximum number of characters to extract.
__delimA "stop" character.
Returns
*this

Extracts and stores characters into __s until one of the following happens. Note that these criteria are required to be tested in the order listed here, to allow an input line to exactly fill the __s array without setting failbit.

  1. the input sequence reaches end-of-file, in which case eofbit is set in the stream error state
  2. the next character equals __delim, in which case the character is extracted (and therefore counted in gcount()) but not stored
  3. __n-1 characters are stored, in which case failbit is set in the stream error state

If no characters are extracted, failbit is set. (An empty line of input should therefore not cause failbit to be set.)

In any case, a null character is stored in the next location in the array.

Definition at line 407 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ getline() [3/3]

basic_istream< char > & std::basic_istream< char >::getline ( char_type *  __s,
streamsize  __n,
char_type  __delim 
)

Explicit specialization declarations, defined in src/istream.cc.

◆ ignore() [1/3]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 467 of file istream.tcc.

◆ ignore() [2/3]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore ( streamsize  __n)

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 500 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount.

◆ ignore() [3/3]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore ( streamsize  __n,
int_type  __delim 
)

Discarding characters.

Parameters
__nNumber of characters to discard.
__delimA "stop" character.
Returns
*this

Extracts characters and throws them away until one of the following happens:

  • if __n != std::numeric_limits<int>::max(), __n characters are extracted
  • the input sequence reaches end-of-file
  • the next character equals __delim (in this case, the character is extracted); note that this condition will never occur if __delim equals traits::eof().

NB: Provide three overloads, instead of the single function (with defaults) mandated by the Standard: this leads to a better performing implementation, while still conforming to the Standard.

Definition at line 562 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ operator=() [1/2]

template<typename _CharT , typename _Traits >
basic_istream& std::basic_istream< _CharT, _Traits >::operator= ( basic_istream< _CharT, _Traits > &&  __rhs)
inlineprotected

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 625 of file istream.

◆ operator=() [2/2]

template<typename _CharT , typename _Traits >
basic_istream& std::basic_istream< _CharT, _Traits >::operator= ( const basic_istream< _CharT, _Traits > &  )
protecteddelete

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

◆ operator>>() [1/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( __istream_type &(*)(__istream_type &)  __pf)
inline

Interface for manipulators.

Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header.

Definition at line 120 of file istream.

◆ operator>>() [2/15]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::operator>> ( __streambuf_type __sb)

Extracting into another streambuf.

Parameters
__sbA pointer to a streambuf

This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.

If __sb is NULL, the stream will set failbit in its error state.

Characters are extracted from this stream and inserted into the __sb streambuf until one of the following occurs:

  • the input stream reaches end-of-file,
  • insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted), or
  • an exception occurs (and in this case is caught)

If the function inserts no characters, failbit is set.

Definition at line 211 of file istream.tcc.

References std::ios_base::goodbit.

◆ operator>>() [3/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( bool &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 168 of file istream.

◆ operator>>() [4/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( double &  __f)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 218 of file istream.

◆ operator>>() [5/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( float &  __f)
inline

Floating point arithmetic extractors.

Parameters
__fA variable of builtin floating point type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 214 of file istream.

◆ operator>>() [6/15]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::operator>> ( int &  __n)

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 166 of file istream.tcc.

◆ operator>>() [7/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( long &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 186 of file istream.

◆ operator>>() [8/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( long double &  __f)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 222 of file istream.

◆ operator>>() [9/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( long long &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 195 of file istream.

◆ operator>>() [10/15]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::operator>> ( short &  __n)

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 121 of file istream.tcc.

References std::ios_base::goodbit.

◆ operator>>() [11/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( unsigned int &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 182 of file istream.

◆ operator>>() [12/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( unsigned long &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 190 of file istream.

◆ operator>>() [13/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( unsigned long long &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 199 of file istream.

◆ operator>>() [14/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( unsigned short &  __n)
inline

Integer arithmetic extractors.

Parameters
__nA variable of builtin integral type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 175 of file istream.

◆ operator>>() [15/15]

template<typename _CharT , typename _Traits >
__istream_type& std::basic_istream< _CharT, _Traits >::operator>> ( void *&  __p)
inline

Basic arithmetic extractors.

Parameters
__pA variable of pointer type.
Returns
*this if successful

These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.

Definition at line 235 of file istream.

◆ peek()

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::peek

Looking ahead in the stream.

Returns
The next character, or eof().

If, after constructing the sentry object, good() is false, returns traits::eof(). Otherwise reads but does not extract the next input character.

Definition at line 627 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ putback()

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::putback ( char_type  __c)

Unextracting a single character.

Parameters
__cThe character to push back into the input stream.
Returns
*this

If rdbuf() is not null, calls rdbuf()->sputbackc(c).

If rdbuf() is null or if sputbackc() fails, sets badbit in the error state.

Note
This function first clears eofbit. Since no characters are extracted, the next call to gcount() will return 0, as required by DR 60.

Definition at line 718 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::eofbit, and std::ios_base::goodbit.

◆ read()

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::read ( char_type *  __s,
streamsize  __n 
)

Extraction without delimiters.

Parameters
__sA character array.
__nMaximum number of characters to store.
Returns
*this

If the stream state is good(), extracts characters and stores them into __s until one of the following happens:

  • __n characters are stored
  • the input sequence reaches end-of-file, in which case the error state is set to failbit|eofbit.
Note
This function is not overloaded on signed char and unsigned char.

Definition at line 657 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ readsome()

template<typename _CharT , typename _Traits >
streamsize std::basic_istream< _CharT, _Traits >::readsome ( char_type *  __s,
streamsize  __n 
)

Extraction until the buffer is exhausted, but no more.

Parameters
__sA character array.
__nMaximum number of characters to store.
Returns
The number of characters extracted.

Extracts characters and stores them into __s depending on the number of characters remaining in the streambuf's buffer, rdbuf()->in_avail(), called A here:

  • if A == -1, sets eofbit and extracts no characters
  • if A == 0, extracts no characters
  • if A > 0, extracts min(A,n)

The goal is to empty the current buffer, and to not request any more from the external input sequence controlled by the streambuf.

Definition at line 686 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.

◆ seekg() [1/2]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::seekg ( off_type  __off,
ios_base::seekdir  __dir 
)

Changing the current read position.

Parameters
__offA file offset object.
__dirThe direction in which to seek.
Returns
*this

If fail() is not true, calls rdbuf()->pubseekoff(__off,__dir). If that function fails, sets failbit.

Note
This function first clears eofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount().

Definition at line 891 of file istream.tcc.

References std::ios_base::eofbit, and std::ios_base::goodbit.

◆ seekg() [2/2]

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::seekg ( pos_type  __pos)

Changing the current read position.

Parameters
__posA file position object.
Returns
*this

If fail() is not true, calls rdbuf()->pubseekpos(__pos). If that function fails, sets failbit.

Note
This function first clears eofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount().

Definition at line 852 of file istream.tcc.

References std::ios_base::eofbit, and std::ios_base::goodbit.

◆ swap()

template<typename _CharT , typename _Traits >
void std::basic_istream< _CharT, _Traits >::swap ( basic_istream< _CharT, _Traits > &  __rhs)
inlineprotected

Simple extraction.

Returns
A character, or eof().

Tries to extract a character. If none are available, sets failbit and returns traits::eof().

Definition at line 632 of file istream.

◆ sync()

template<typename _CharT , typename _Traits >
int std::basic_istream< _CharT, _Traits >::sync

Synchronizing the stream buffer.

Returns
0 on success, -1 on failure

If rdbuf() is a null pointer, returns -1.

Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit and returns -1.

Otherwise, returns 0.

Note
This function does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount().

Definition at line 788 of file istream.tcc.

References std::ios_base::goodbit.

◆ tellg()

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits >::pos_type std::basic_istream< _CharT, _Traits >::tellg

Getting the current read position.

Returns
A file position object.

If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,in).

Note
This function does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount(). At variance with putback, unget and seekg, eofbit is not cleared first.

Definition at line 824 of file istream.tcc.

◆ unget()

template<typename _CharT , typename _Traits >
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::unget

Unextracting the previous character.

Returns
*this

If rdbuf() is not null, calls rdbuf()->sungetc(c).

If rdbuf() is null or if sungetc() fails, sets badbit in the error state.

Note
This function first clears eofbit. Since no characters are extracted, the next call to gcount() will return 0, as required by DR 60.

Definition at line 753 of file istream.tcc.

References std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::eofbit, and std::ios_base::goodbit.

Referenced by std::__detail::operator>>().

Member Data Documentation

◆ _M_gcount


The documentation for this class was generated from the following files: