STD::BASIC_ISTREAM(3)

๐ŸŒธ std::basic_istream< _CharT, _Traits >(3) ๐ŸŒธ โ€” Library Functions Manual


โœจ NAME โœจ

std::basic_istream< _CharT, _Traits > โ€” bestie, it's the template class basic_istream. That's it. That's the whole vibe. ๐Ÿ’–


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

#include <istream>

Okay so first things first, this class inherits std::basic_ios< _CharT, _Traits >. Family tree moment. ๐ŸŒณ

And it's inherited by a whole friend group: std::basic_ifstream< char >, std::basic_ifstream< wchar_t >, std::basic_iostream< char >, std::basic_iostream< wchar_t >, std::basic_istringstream< char >, std::basic_istringstream< wchar_t >, std::basic_ifstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, and std::basic_istringstream< _CharT, _Traits, _Alloc >. Iconic lineage fr fr. ๐Ÿ‘‘


๐ŸŽ€ Classes

  • class sentry โ€” does the setup work for input streams. Think of it as the little pre-game ritual before any extraction happens. It's giving backstage pass. ๐ŸŽŸ๏ธ

๐ŸŒˆ 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
  • enum event { erase_event, imbue_event, copyfmt_event } โ€” the set of events that may be passed to an event callback. Yes queen, these are the events.
  • typedef void(* event_callback) (event __e, ios_base &__b, int __i) โ€” the type of an event callback function. Basically the shape of the function you hand over. ๐Ÿ’…
  • typedef _Ios_Fmtflags fmtflags โ€” this is a bitmask type.
  • typedef _Traits::int_type int_type
  • typedef _Ios_Iostate iostate โ€” this is a bitmask type too.
  • typedef _Traits::off_type off_type
  • typedef _Ios_Openmode openmode โ€” also a bitmask type. They really said "bitmask" three times, and honestly? Slay.
  • typedef _Traits::pos_type pos_type
  • typedef _Ios_Seekdir seekdir โ€” this one's an enumerated type, not a bitmask. Different energy.
  • typedef _Traits traits_type
  • typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_type

๐Ÿ’œ Public Member Functions

Okay bestie, this is the big list, hydrate before you read it. ๐Ÿ“

  • basic_istream (__streambuf_type *__sb) โ€” base constructor. The origin story. ๐ŸŒฑ
  • virtual ~basic_istream () โ€” base destructor. It says goodbye. ๐Ÿ˜ญ
  • template<typename _ValueT> basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)
  • const locale & _M_getloc () const โ€” locale access.
  • void _M_setstate (iostate __state)
  • bool bad () const โ€” fast error checking. Is it bad? Check fast.
  • void clear (iostate __state=goodbit) โ€” [re]sets the error state.
  • basic_ios & copyfmt (const basic_ios &__rhs) โ€” copies the fields of __rhs into this. Copy-paste but make it โœจformatโœจ.
  • bool eof () const โ€” fast error checking.
  • iostate exceptions () const โ€” throwing exceptions on errors.
  • void exceptions (iostate __except) โ€” throwing exceptions on errors.
  • bool fail () const โ€” fast error checking.
  • char_type fill () const โ€” retrieves the empty character. Not an empty personality, just an empty char. ๐Ÿซถ
  • char_type fill (char_type __ch) โ€” sets a new empty character.
  • fmtflags flags () const โ€” access to format flags.
  • fmtflags flags (fmtflags __fmtfl) โ€” setting new format flags all at once. All at once, no cap.
  • streamsize gcount () const โ€” character counting.
  • basic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)
  • basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)
    • These are explicit specialization declarations, defined in src/istream.cc. ๐Ÿ“
  • locale getloc () const โ€” locale access.
  • bool good () const โ€” fast error checking.
  • basic_istream< wchar_t > & ignore (streamsize __n)
  • basic_istream< char > & ignore (streamsize __n)
  • basic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)
  • basic_istream< char > & ignore (streamsize __n, int_type __delim)
  • locale imbue (const locale &__loc) โ€” moves to a new locale. Glow-up, but for locales. ๐ŸŒ
  • long & iword (int __ix) โ€” access to integer array.
  • char narrow (char_type __c, char __dfault) const โ€” squeezes characters.
  • __istream_type & operator>> (__streambuf_type *__sb) โ€” extracting into another streambuf.
  • __istream_type & operator>> (void *&__p) โ€” basic arithmetic extractors.
  • streamsize precision () const โ€” flags access.
  • streamsize precision (streamsize __prec) โ€” changing flags.
  • void *& pword (int __ix) โ€” access to void pointer array.
  • basic_streambuf< _CharT, _Traits > * rdbuf () const โ€” accessing the underlying buffer.
  • basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb) โ€” changing the underlying buffer.
  • iostate rdstate () const โ€” returns the error state of the stream buffer.
  • void register_callback (event_callback __fn, int __index) โ€” add the callback __fn with parameter __index.
  • fmtflags setf (fmtflags __fmtfl) โ€” setting new format flags.
  • fmtflags setf (fmtflags __fmtfl, fmtflags __mask) โ€” setting new format flags.
  • void setstate (iostate __state) โ€” sets additional flags in the error state.
  • basic_ostream< _CharT, _Traits > * tie () const โ€” fetches the current tied stream.
  • basic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr) โ€” ties this stream to an output stream. Literally tying the knot. ๐Ÿ’
  • void unsetf (fmtflags __mask) โ€” clearing format flags.
  • char_type widen (char __c) const โ€” widens characters.
  • streamsize width () const โ€” flags access.
  • streamsize width (streamsize __wide) โ€” changing flags.
  • __istream_type & operator>> (__istream_type &(*__pf)(__istream_type &)) โ€” interface for manipulators.
  • __istream_type & operator>> (__ios_type &(*__pf)(__ios_type &)) โ€” interface for manipulators.
  • __istream_type & operator>> (ios_base &(*__pf)(ios_base &)) โ€” interface for manipulators.

๐Ÿ”ฅ Extractors

So, all the operator>> functions (aka the formatted input functions) share some common behavior, and you need to know it:

Every single one starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to false. That has several effects, and it all wraps up with the setting of a status flag โ€” see the sentry documentation for the full tea. โ˜•

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

โš ๏ธ 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. Not me warning you dramatically, but like, do read that twice. ๐Ÿ˜ญ
  • __istream_type & operator>> (bool &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (short &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (unsigned short &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (int &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (unsigned int &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (long &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (unsigned long &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (long long &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (unsigned long long &__n) โ€” integer arithmetic extractors.
  • __istream_type & operator>> (float &__f) โ€” floating point arithmetic extractors.
  • __istream_type & operator>> (double &__f) โ€” floating point arithmetic extractors.
  • __istream_type & operator>> (long double &__f) โ€” floating point arithmetic extractors.

๐ŸŒธ Unformatted Input Functions

Same deal, but different. All the unformatted input functions share some common behavior too:

Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. Several effects follow, concluding with the setting of a status flag โ€” again, sentry documentation has the details. ๐Ÿงš

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. Same warning, same energy, still important.
  • int_type get () โ€” simple extraction.
  • __istream_type & get (char_type &__c) โ€” simple 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 & get (__streambuf_type &__sb, char_type __delim) โ€” extraction into another streambuf.
  • __istream_type & get (__streambuf_type &__sb) โ€” extraction into another streambuf.
  • __istream_type & getline (char_type *__s, streamsize __n, char_type __delim) โ€” string extraction.
  • __istream_type & getline (char_type *__s, streamsize __n) โ€” string extraction.
  • __istream_type & ignore (streamsize __n, int_type __delim) โ€” discarding characters.
  • __istream_type & ignore (streamsize __n) โ€” simple extraction.
  • __istream_type & ignore () โ€” simple extraction.
  • __istream_type & ignore (streamsize __n, char __delim) โ€” simple extraction.
  • int_type peek () โ€” looking ahead in the stream. ๐Ÿ‘€ No touching, just looking.
  • __istream_type & read (char_type *__s, streamsize __n) โ€” extraction without delimiters.
  • streamsize readsome (char_type *__s, streamsize __n) โ€” extraction until the buffer is exhausted, but no more. Boundaries, we love to see them. โœ‹
  • __istream_type & putback (char_type __c) โ€” unextracting a single character.
  • __istream_type & unget () โ€” unextracting the previous character.
  • int sync () โ€” synchronizing the stream buffer.
  • pos_type tellg () โ€” getting the current read position.
  • __istream_type & seekg (pos_type) โ€” changing the current read position.
  • __istream_type & seekg (off_type, ios_base::seekdir) โ€” changing the current read position.
  • operator bool () const โ€” the quick-and-easy status check.
  • bool operator! () const โ€” the quick-and-easy status check.

๐Ÿ‘‘ Static Public Member Functions

  • static bool sync_with_stdio (bool __sync=true) โ€” interaction with the standard C I/O objects.
  • static int xalloc () throw () โ€” access to unique indices.

โœจ Static Public Attributes โœจ

  • static const openmode __noreplace โ€” that's it, that's the attribute, no lil description attached, she simply exists ๐Ÿ’…
  • static const fmtflags adjustfield โ€” a mask of left|right|internal. lowkey a lifesaver for the 2-arg form of setf.
  • static const openmode app โ€” seek to the end before each write. every single one bestie, no skipping.
  • static const openmode ate โ€” open and seek to the end immediately after opening. it's giving "already at the back of the line" energy.
  • static const iostate badbit โ€” indicates a loss of integrity in an input or output sequence (like, say, an irrecoverable read error from a file). this is the ๐Ÿ’€ flag.
  • static const fmtflags basefield โ€” a mask of dec|oct|hex. perfect for the 2-arg form of setf.
  • static const seekdir beg โ€” request a seek relative to the beginning of the stream. back to square one, fr.
  • static const openmode binary โ€” perform input and output in binary mode (as opposed to text mode). > this is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. no cap, go read it.
  • static const fmtflags boolalpha โ€” insert/extract bool in alphabetic rather than numeric format. words over numbers, iconic.
  • static const seekdir cur โ€” request a seek relative to the current position within the sequence. right where you left it, bestie.
  • static const fmtflags dec โ€” converts integer input or generates integer output in decimal base.
  • static const seekdir end โ€” request a seek relative to the current end of the sequence.
  • static const iostate eofbit โ€” indicates that an input operation reached the end of an input sequence. the end, periodt.
  • static const iostate failbit โ€” indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. it tried, it flopped ๐Ÿฅฒ
  • static const fmtflags fixed โ€” generate floating-point output in fixed-point notation.
  • static const fmtflags floatfield โ€” a mask of scientific|fixed. yes, it's for the 2-arg form of setf. you know the drill by now.
  • static const iostate goodbit โ€” indicates all is well ๐Ÿซถ everything's fine, nothing to see here, she's thriving.
  • static const fmtflags hex โ€” converts integer input or generates integer output in hexadecimal base.
  • static const openmode in โ€” open for input. the default for ifstream and fstream.
  • static const fmtflags internal โ€” adds fill characters at a designated internal point in certain generated output, or identical to right if no such point is designated.
  • static const fmtflags left โ€” adds fill characters on the right (final positions) of certain generated output. (i.e., the thing you print is flush left.)
  • static const fmtflags oct โ€” converts integer input or generates integer output in octal base.
  • static const openmode out โ€” open for output. the default for ofstream and fstream.
  • static const fmtflags right โ€” adds fill characters on the left (initial positions) of certain generated output. (i.e., the thing you print is flush right.)
  • static const fmtflags scientific โ€” generates floating-point output in scientific notation. science slay ๐Ÿ”ฅ
  • static const fmtflags showbase โ€” generates a prefix indicating the numeric base of generated integer output.
  • static const fmtflags showpoint โ€” generates a decimal-point character unconditionally in generated floating-point output. she said "you WILL see my point".
  • static const fmtflags showpos โ€” generates a + sign in non-negative generated numeric output.
  • static const fmtflags skipws โ€” skips leading white space before certain input operations.
  • static const openmode trunc โ€” truncate an existing stream when opening. the default for ofstream. bye bye old contents ๐Ÿฅ€
  • static const fmtflags unitbuf โ€” flushes output after each output operation.
  • static const fmtflags uppercase โ€” replaces certain lowercase letters with their uppercase equivalents in generated output. LOUDER ๐Ÿ“ข

๐ŸŽ€ Protected Types ๐ŸŽ€

  • enum { _S_local_word_size } โ€” a lil anonymous enum, just vibing, just holding a size.

๐Ÿฆ‹ Protected Member Functions ๐Ÿฆ‹

  • basic_istream (basic_istream &&__rhs)
  • basic_istream (const basic_istream &)=delete โ€” copy construction? deleted. not today bestie.
  • void _M_cache_locale (const locale &__loc)
  • void _M_call_callbacks (event __ev) throw ()
  • void _M_dispose_callbacks (void) throw ()
  • template<typename _ValueT> __istream_type & _M_extract (_ValueT &__v)
  • _Words & _M_grow_words (int __index, bool __iword)
  • void _M_init () throw ()
  • void _M_move (ios_base &) noexcept
  • void _M_swap (ios_base &__rhs) noexcept
  • void init (basic_streambuf< _CharT, _Traits > *__sb) โ€” all setup is performed here. the whole get-ready-with-me moment, right here.
  • void move (basic_ios &&__rhs)
  • void move (basic_ios &__rhs)
  • basic_istream & operator= (basic_istream &&__rhs)
  • basic_istream & operator= (const basic_istream &)=delete โ€” copy assignment also deleted. consistency queen ๐Ÿ’…
  • void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)
  • void swap (basic_ios &__rhs) noexcept
  • void swap (basic_istream &__rhs)

๐Ÿ’œ Protected Attributes ๐Ÿ’œ

  • _Callback_list * _M_callbacks
  • const __ctype_type * _M_ctype
  • iostate _M_exception
  • char_type _M_fill
  • bool _M_fill_init
  • fmtflags _M_flags
  • streamsize _M_gcount
  • locale _M_ios_locale
  • _Words _M_local_word [_S_local_word_size]
  • const __num_get_type * _M_num_get
  • const __num_put_type * _M_num_put
  • streamsize _M_precision
  • basic_streambuf< _CharT, _Traits > * _M_streambuf
  • iostate _M_streambuf_state
  • basic_ostream< _CharT, _Traits > * _M_tie
  • streamsize _M_width
  • _Words * _M_word
  • int _M_word_size
  • _Words _M_word_zero

๐ŸŒˆ Friends ๐ŸŒˆ

  • class sentry โ€” that's the whole friend list. just the one. quality over quantity, iykyk.

โญ Detailed Description โญ

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

"Template class basic_istream.

๐Ÿ“ Template Parameters ๐Ÿ“

  • _CharT โ€” type of character stream.
  • _Traits โ€” traits for character type, defaults to char_traits<_CharT>.

This is the base class for all input streams, no cap. It provides text formatting of all builtin types, and it communicates with any class derived from basic_streambuf to do the actual input. so basically she's the main character and the streambuf does the running around behind the scenes ๐Ÿ’…


โœจ Member Typedef Documentation โœจ

template<typename _CharT, typename _Traits> typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_put_type [inherited]

These are non-standard types. yeah. non-standard. she's special like that ๐ŸŽ€

typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]

The type of an event callback function. so this is the shape of a function that gets pinged when stuff goes down.

Parameters, bestie:

  • __e โ€” one of the members of the event enum.
  • __b โ€” reference to the ios_base object.
  • __i โ€” the integer provided when the callback was registered.

Event callbacks are user defined functions that get called during several ios_base and basic_ios functions, specifically imbue(), copyfmt(), and ~ios().

typedef _Ios_Fmtflags std::ios_base::fmtflags [inherited]

This is a bitmask type. _Ios_Fmtflags is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type fmtflags are:

  • boolalpha
  • dec
  • fixed
  • hex
  • internal
  • left
  • oct
  • right
  • scientific
  • showbase
  • showpoint
  • showpos
  • skipws
  • unitbuf
  • uppercase
  • adjustfield
  • basefield
  • floatfield

typedef _Ios_Iostate std::ios_base::iostate [inherited]

This is a bitmask type. _Ios_Iostate is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type iostate are:

  • badbit
  • eofbit
  • failbit
  • goodbit

typedef _Ios_Openmode std::ios_base::openmode [inherited]

This is a bitmask type. _Ios_Openmode is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type openmode are:

  • app
  • ate
  • binary
  • in
  • out
  • trunc

typedef _Ios_Seekdir std::ios_base::seekdir [inherited]

This is an enumerated type. _Ios_Seekdir is implementation-defined. Defined values of type seekdir are:

  • beg
  • cur, equivalent to SEEK_CUR in the C standard library.
  • end, equivalent to SEEK_END in the C standard library.

๐ŸŒธ Member Enumeration Documentation ๐ŸŒธ

enum std::ios_base::event [inherited]

The set of events that may be passed to an event callback. erase_event is used during ~ios() and copyfmt(). imbue_event is used during imbue(). copyfmt_event is used during copyfmt(). three lil events, three lil moments, all iconic ๐Ÿ’–


๐Ÿ’ซ Constructor & Destructor Documentation ๐Ÿ’ซ

template<typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits >::basic_istream (__streambuf_type * __sb) [inline], [explicit]

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.

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry().

template<typename _CharT, typename _Traits> virtual std::basic_istream< _CharT, _Traits >::~basic_istream () [inline], [virtual]

Base destructor. This does very little apart from providing a virtual base dtor. she's chill like that, does her one job and dips ๐Ÿฆ‹


๐Ÿ”ฅ Member Function Documentation ๐Ÿ”ฅ

const locale & std::ios_base::_M_getloc () const [inline], [inherited]

Locale access. she's your plug for the current locale.

Returns: a reference to the current locale.

Like getloc above, but returns a reference instead of generating a copy. so she's the efficient version, no unnecessary copying, very demure.

Referenced by std::money_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put(). literally everyone wants a piece of her.

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [nodiscard], [inherited]

Fast error checking. quick lil vibe check on whether things went wrong.

Returns: true if the badbit is set.

heads up: other iostate flags may also be set. so bad() saying true doesn't mean the others are quiet, bestie.

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry().

template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]

[Re]sets the error state. reset era ๐ŸŽ€

Parameters:

  • __state โ€” the new state flag(s) to set.

See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument โ€” the default goodbit is doing the heavy lifting for you.

References std::ios_base::badbit, exceptions(), rdbuf(), and rdstate().

Referenced by:

  • std::basic_ios< char_type, traits_type >::exceptions()
  • std::basic_fstream< char >::open()
  • std::basic_fstream< char >::open()
  • std::basic_ifstream< char >::open()
  • std::basic_ifstream< char >::open()
  • std::basic_ofstream< char >::open()
  • std::basic_ofstream< char >::open()
  • std::__detail::operator>>()
  • std::basic_istream< _CharT, _Traits >::putback()
  • rdbuf()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_ios< char_type, traits_type >::setstate()
  • std::basic_istream< _CharT, _Traits >::unget()

okay bestie yes open() is listed twice per stream and no I did not do a typo, that's literally what the docs say ๐Ÿซถ moving on.


copyfmt โ€” the glow-up montage ๐Ÿ’…

template<typename _CharT, typename _Traits> basic_ios< _CharT, _Traits > &
    std::basic_ios< _CharT, _Traits >::copyfmt (const basic_ios< _CharT,
    _Traits > & __rhs) [inherited]

Copies fields of __rhs into this. It's giving "make this stream look exactly like that stream" energy โœจ

Parameters

  • __rhs โ€” The source values for the copies.

Returns

  • Reference to this object.

So here's the tea: all fields of __rhs get copied into this object, except rdbuf() and rdstate() โ€” those two stay exactly as they were, no touchy ๐Ÿ™…โ€โ™€๏ธ. All values in the pword and iword arrays get copied too. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. And the grand finale? The final step is to copy exceptions().

References: basic_ios(), std::__addressof(), exceptions(), fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), tie(), std::tie(), and std::ios_base::width().


eof โ€” vibe check, but for end-of-file ๐ŸŒธ

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
    _Traits >::eof () const [inline],  [nodiscard],  [inherited]

Fast error checking. Like, speedrun edition ๐Ÿƒโ€โ™€๏ธ

Returns

  • True if the eofbit is set.
heads up bestie: other iostate flags may also be set. eof being true does NOT mean everything else is chill ๐Ÿ˜ญ

exceptions (the const one) โ€” mask reveal ๐Ÿ‘‘

template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT,
    _Traits >::exceptions () const [inline],  [nodiscard],  [inherited]

Throwing exceptions on errors.

Returns

  • The current exceptions mask.

This changes nothing in the stream โ€” it's a read-only peek, no notes taken ๐Ÿ‘€. See the one-argument version of exceptions(iostate) for the meaning of the return value.

Referenced by: clear(), and copyfmt().


exceptions (the setter one) โ€” now you're setting the mask ๐Ÿ’€

template<typename _CharT, typename _Traits> void std::basic_ios< _CharT,
    _Traits >::exceptions (iostate __except) [inline],  [inherited]

Throwing exceptions on errors.

Parameters

  • __except โ€” The new exceptions mask.

So by default, error flags are set silently. Like, no drama, they just sit there ๐Ÿ˜ถ. But you can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown. periodt.

careful babe: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. no waiting, no chill, instant chaos ๐Ÿ”ฅ

Try running the following under GCC 3.1 or later:

#include <iostream>
#include <fstream>
#include <exception>

int main()
{
    std::set_terminate (__gnu_cxx::__verbose_terminate_handler);

    std::ifstream f ("/etc/motd");

    std::cerr << "Setting badbit\n";
    f.setstate (std::ios_base::badbit);

    std::cerr << "Setting exception mask\n";
    f.exceptions (std::ios_base::badbit);
}

fail โ€” another fast error check, we love consistency โœจ

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
    _Traits >::fail () const [inline],  [nodiscard],  [inherited]

Fast error checking.

Returns

  • True if either the badbit or the failbit is set.

Fun little lore drop: checking the badbit in fail() is historical practice ๐Ÿ“œ. And again โ€” note that other iostate flags may also be set.

Referenced by: std::basic_ios< char_type, traits_type >::operator bool(), std::basic_ios< char_type, traits_type >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().


fill (getter) โ€” the empty character, she's so iconic ๐ŸŽ€

template<typename _CharT, typename _Traits> char_type std::basic_ios<
    _CharT, _Traits >::fill () const [inline],  [nodiscard],  [inherited]

Retrieves the empty character.

Returns

  • The current fill character.

It defaults to a space (' ') in the current locale. simple as that ๐ŸŒˆ

Referenced by: copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.


fill (setter) โ€” new character just dropped ๐Ÿฆ‹

template<typename _CharT, typename _Traits> char_type std::basic_ios<
    _CharT, _Traits >::fill (char_type __ch) [inline],  [inherited]

Sets a new empty character.

Parameters

  • __ch โ€” The new character.

Returns

  • The previous fill character.

Okay so here's when the fill character even matters: it's used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. And yeah, it defaults to a space (' ') in the current locale.


flags (getter) โ€” format flags, come get y'all ๐Ÿงš

fmtflags std::ios_base::flags () const [inline],  [nodiscard],  [inherited]

Access to format flags.

Returns

  • The format control flags for both input and output.

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.

(yes that's a lot of std::operator>>() in a row. the docs said it, I said it, we move ๐Ÿ’€)


flags (setter) โ€” swap the whole vibe in one go ๐Ÿ’…

fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline],  [inherited]

Setting new format flags all at once.

Parameters

  • __fmtfl โ€” The new flags to set.

Returns

  • The previous format control flags.
heads up: this function overwrites all the format flags with __fmtfl. it's not a merge, it's a full replace, no survivors ๐Ÿ”ฅ

gcount โ€” how many characters did we just eat? ๐Ÿ“

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.

get โ€” simple extraction ๐ŸŽ€

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

Simple extraction.

Returns

  • A character, or eof().

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

References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().

Referenced by: std::basic_istream< char_type, traits_type >::get(), and std::basic_istream< char_type, traits_type >::get().


get โ€” extraction into another streambuf ๐Ÿฆ‹

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

Extraction into another streambuf.

Parameters

  • __sb โ€” A streambuf in which to store data.

Returns

  • *this

Returns get(__sb,widen('\n')). cute little delegation moment โœจ


get โ€” extraction into another streambuf, with a stop character ๐ŸŒธ

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

  • __sb โ€” A streambuf in which to store data.
  • __delim โ€” A "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. ๐Ÿ˜ญ

References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().


get โ€” simple extraction, single character ๐ŸŽ€

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

Simple extraction.

Parameters

  • __c โ€” The 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. like, at all. don't come for me ๐Ÿ™ˆ

References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


get โ€” multiple characters, go off ๐Ÿ‘‘

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

Simple multiple-character extraction.

Parameters

  • __s โ€” Pointer to an array.
  • __n โ€” Maximum number of characters to store in s.

Returns

  • *this

Returns get(__s,__n,widen('\n')). again with the delegation, we love a wrapper ๐Ÿ’œ


get โ€” multiple characters with a stop character ๐ŸŒˆ

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

  • __s โ€” Pointer to an array.
  • __n โ€” Maximum number of characters to store in __s.
  • __delim โ€” A "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. ๐Ÿ’€

And in any case, a null character is stored into the next location in the array. always. no exceptions bestie.

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

References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().


getline โ€” string extraction, the moment we've all been waiting for โœจ

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

String extraction.

Parameters

  • __s โ€” A character array in which to store the data.
  • __n โ€” Maximum number of characters to extract.

Returns

  • *this

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


getline โ€” the char specialization ๐ŸŒŸ

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

Explicit specialization declarations, defined in src/istream.cc. that's the whole thing, she's special and she knows it ๐Ÿ’…


getline โ€” the template one, back at it again ๐Ÿซถ

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

  • __s โ€” a character array in which to store the data ๐Ÿ’พ
  • __n โ€” maximum number of characters to extract
  • __delim โ€” a "stop" character ๐Ÿ›‘

Returns

*this ๐Ÿซถ

So it extracts and stores characters into __s until one of the following happens. And bestie, note that these criteria are required to be tested in the order listed here โ€” that's the whole reason an input line can exactly fill the __s array without setting failbit. Order is the moment, ok? ๐Ÿ‘‘

  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 โ€” which is honestly so valid of it. ๐ŸŒธ)

In any case, a null character is stored in the next location in the array. ๐ŸŽ€

Referenced by std::basic_istream< char_type, traits_type >::getline().


locale std::ios_base::getloc () const [inline], [nodiscard], [inherited]

Locale access. ๐ŸŒ

Returns

A copy of the current locale.

So if imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. Either way you get a locale, periodt.

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::basic_ios< _CharT, _Traits >::imbue(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().


template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::good () const [inline], [nodiscard], [inherited]

Fast error checking. โšก

Returns

True if no error flags are set.

It's literally just a wrapper around rdstate. Simple. Clean. Iconic. ๐Ÿ’…

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().


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

Simple extraction.

Returns

A character, or eof().

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

References _M_gcount, std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sbumpc().

Referenced by std::basic_istream< char_type, traits_type >::ignore().


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, it sets failbit and returns traits::eof().

References _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().


template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, char __delim) [inline]

Simple extraction.

Returns

A character, or eof().

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


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

Discarding characters. ๐Ÿ—‘๏ธโœจ

Parameters

  • __n โ€” number of characters to discard
  • __delim โ€” a "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 four 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. ๐Ÿ’€ not them optimizing the overloads

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


template<typename _CharT, typename _Traits> locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]

Moves to a new locale. ๐Ÿฆ‹

Parameters

  • __loc โ€” the new locale

Returns

The previous locale.

Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc).

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

References std::ios_base::getloc(), std::ios_base::imbue(), and rdbuf().

Referenced by std::chrono::operator<<().


template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]

All setup is performed here. This is called from the public constructor. It is not virtual and cannot be redefined. ๐Ÿšซ (main character energy, refuses to be overridden)

Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().


long & std::ios_base::iword (int __ix) [inline], [inherited]

Access to integer array. ๐Ÿ”ข

Parameters

  • __ix โ€” index into the array

Returns

A reference to an integer associated with the index.

The iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0.

The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. ๐Ÿ™ˆ don't be out here keeping stale refs bestie

References iword().

Referenced by iword().


template<typename _CharT, typename _Traits> char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]

Squeezes characters. ๐Ÿงš

Parameters

  • __c โ€” the character to narrow
  • __dfault โ€” the character to narrow

Returns

The narrowed character.

Maps a character of char_type to a character of char, if possible.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html


template<typename _CharT, typename _Traits> std::basic_ios< _CharT, _Traits >::operator bool () const [inline], [explicit], [nodiscard], [inherited]

The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... ๐ŸŒˆ


template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::operator! () const [inline], [nodiscard], [inherited]

The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... ๐ŸŒˆ


template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__ios_type &(* __pf )(__ios_type &)) [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.


template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__istream_type &(* __pf )(__istream_type &)) [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.


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

Extracting into another streambuf. ๐Ÿšฐ

Parameters

  • __sb โ€” a 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.

References std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


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

Integer arithmetic extractors. ๐Ÿ”ข

Parameters

  • __n โ€” a 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. ๐Ÿ“


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

Floating point arithmetic extractors. ๐Ÿงฎ

Parameters

  • __f โ€” a 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. ๐Ÿ“


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

Floating point arithmetic extractors. ๐Ÿงฎ

Parameters

  • __f โ€” a 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. ๐Ÿ“

okay so literally every one of these extractors parses your input using the stream's current locale โ€” specifically the num_get facet. that's the whole vibe, no cap. ๐Ÿ’…


๐ŸŒŸ operator>> (int) โ€” integer arithmetic extractor

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

Integer arithmetic extractors. bestie these are the moment โœจ

Parameters

  • __n โ€” a 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.


๐ŸŽ€ operator>> (manipulators) โ€” ios_base &(*__pf)(ios_base &) โ€” [inline]

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

Interface for manipulators. manipulators like std::ws and std::dec use these functions in constructs such as std::cin >> std::ws. wanna know more? go peek at the iomanip header, iykyk ๐Ÿ‘‘


๐Ÿฆ‹ operator>> (long) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐Ÿ“ operator>> (long double) โ€” [inline]

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

Floating point arithmetic extractors. yes girl, floats get their own little corner ๐Ÿ’…

Parameters

  • __f โ€” a 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.


๐Ÿ’œ operator>> (long long) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐ŸŒˆ operator>> (short)

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.

References โ€” std::ios_base::badbit, std::ios_base::failbit, std::num_get< _CharT, _InIter >::get(), std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet(). ๐Ÿ“š


๐Ÿ’– operator>> (unsigned int) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐ŸŽ€ operator>> (unsigned long) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐Ÿฆ‹ operator>> (unsigned long long) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐Ÿ’… operator>> (unsigned short) โ€” [inline]

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

Integer arithmetic extractors.

Parameters

  • __n โ€” a 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.


๐Ÿ‘‘ operator>> (void*) โ€” [inline]

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

Basic arithmetic extractors. pointers get to play too, periodt ๐Ÿ’…

Parameters

  • __p โ€” a 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.


๐Ÿ”ฅ peek โ€” looking ahead in the stream

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

Looking ahead in the stream. the main character move of glancing before you commit ๐Ÿ’ซ

Returns

  • the next character, or eof(). ๐Ÿ˜ญ

so like โ€” after constructing the sentry object, if good() is false, it returns traits::eof(). otherwise it reads but does not extract the next input character. peek don't snatch, bestie ๐Ÿ™ˆ

References โ€” _M_gcount, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdbuf(). ๐Ÿ“š


๐ŸŒธ std::ios_base::precision() โ€” [inline], [nodiscard], [inherited]

streamsize std::ios_base::precision() const

Flags access.

Returns

  • the precision to generate on certain output operations. โœจ
โš ๏ธ be careful if you try to give a definition of precision here โ€” see DR 189. no cap, this one's a trap ๐Ÿšฉ

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<(). ๐Ÿ’œ


๐Ÿงš std::ios_base::precision(streamsize __prec) โ€” [inline], [inherited]

streamsize std::ios_base::precision(streamsize __prec)

Changing flags.

Parameters

  • __prec โ€” the new precision value ๐ŸŽ€

Returns

  • the previous value of precision(). โญ

๐ŸŽ€ putback โ€” unextracting a single character

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

Unextracting a single character. it's giving "jk bestie, put it back" ๐Ÿ’…

Parameters

  • __c โ€” the character to push back into the input stream ๐Ÿซถ

Returns

  • *this ๐Ÿ’–

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

if rdbuf() is null, or if sputbackc() fails, it 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. iconic behaviour honestly โœจ

References โ€” _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_streambuf< _CharT, _Traits >::sputbackc(). ๐Ÿ“š

Referenced by std::operator<<(). ๐Ÿ’œ


๐Ÿฆ‹ std::ios_base::pword(int __ix) โ€” [inline], [inherited]

void*& std::ios_base::pword(int __ix)

Access to void pointer array.

Parameters

  • __ix โ€” index into the array ๐ŸŒธ

Returns

  • a reference to a void* associated with the index. โญ

so the pword function provides access to an array of pointers that can be used for any purpose. the array grows as required to hold the supplied index, and all pointers in the array are initialized to 0. ๐Ÿซถ

๐Ÿšฉ the implementation reserves several indices. you should use xalloc to obtain an index that is safe to use. also note that since the array can grow dynamically, it is not safe to hold onto the reference. lowkey important, don't skip this one bestie ๐Ÿ˜ญ

๐Ÿ’œ std::basic_ios< _CharT, _Traits >::rdbuf() const โ€” [inline], [nodiscard], [inherited]

template<typename _CharT, typename _Traits>
basic_streambuf<_CharT, _Traits>*
std::basic_ios<_CharT, _Traits>::rdbuf() const

Accessing the underlying buffer.

Returns

  • the current stream buffer. ๐Ÿ‘‘

this does not change the state of the stream. no drama, no side effects โœจ

Referenced by clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), imbue(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_ostream< _CharT, _Traits >::tellp(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws(). that's a LOT of friends, main character energy fr fr ๐Ÿ’…๐Ÿ“š


๐ŸŽ€ std::basic_ios< _CharT, _Traits >::rdbuf(basic_streambuf< _CharT, _Traits > * __sb) โ€” [inherited]

template<typename _CharT, typename _Traits>
basic_streambuf<_CharT, _Traits>*
std::basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)

Changing the underlying buffer.

Parameters

  • __sb โ€” the new stream buffer ๐ŸŒธ

Returns

  • the previous stream buffer. โญ

it associates a new buffer with the current stream, and clears the error state. โœจ

๐Ÿ’€ okay so, due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. as a result, you must use explicit qualifications to access this function via any derived class. for example:
std::fstream     foo;         // or some other derived type
std::streambuf*  p = .....;

foo.ios::rdbuf(p);            // ios == basic_ios<char>

References โ€” clear(). ๐Ÿ“š


๐Ÿงš std::basic_ios< _CharT, _Traits >::rdstate() const โ€” [inline], [nodiscard], [inherited]

template<typename _CharT, typename _Traits>
iostate
std::basic_ios<_CharT, _Traits>::rdstate() const

Returns the error state of the stream buffer.

Returns

  • a bit pattern (well, isn't everything?) ๐Ÿ˜ญ๐Ÿ’…

see std::ios_base::iostate for the possible bit values. most users will call one of the interpreting wrappers, e.g., good(). ๐Ÿซถ

Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget(). ๐Ÿ“š


๐ŸŒˆ read โ€” extraction without delimiters

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

Extraction without delimiters. it takes exactly what you ask for, no negotiating โœจ

Parameters

  • __s โ€” a character array ๐ŸŒธ
  • __n โ€” maximum number of characters to store ๐ŸŽ€

Returns

  • *this ๐Ÿ’–

okay so back to read โ€” when the stream state is good(), it pulls characters out and drops them into __s until one of these things happens:

  • __n characters have been stored
  • the input sequence hits end-of-file, in which case the error state gets set to failbit|eofbit.
Note bestie ๐Ÿ“Œ this function is not overloaded on signed char and unsigned char.

References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().


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

Extraction until the buffer is exhausted, but no more. likeโ€ฆ it takes what's there and dips, no begging for more ๐Ÿ’…

Parameters

  • __s โ€” a character array.
  • __n โ€” maximum number of characters to store.

Returns

The number of characters extracted.

So it extracts characters and stores them into __s, and how many it takes depends on how many characters are left sitting in the streambuf's buffer, rdbuf()->in_avail(), which we're calling A here:

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

The goal is literally to empty the current buffer and not request anything more from the external input sequence that the streambuf is controlling. main character energy of just taking what's already on the table ๐Ÿ“

References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::goodbit, std::min(), std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().


void std::ios_base::register_callback(event_callback __fn, int __index)

[inherited] โ€” Add the callback __fn with parameter __index. ๐ŸŽ€

Parameters

  • __fn โ€” the function to add.
  • __index โ€” the integer to pass to the function when invoked.

So it registers a function as an event callback, with an integer parameter that gets passed to the function whenever it's invoked. Multiple copies of the same function are allowed, no gatekeeping here. And if there are multiple callbacks, they get invoked in the order they were registered โ€” first come, first served, periodt. โœจ


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

Changing the current read position. glow-up for your cursor position ๐Ÿ’ซ

Parameters

  • __off โ€” a file offset object.
  • __dir โ€” the direction in which to seek.

Returns

*this

If fail() is not true, it calls rdbuf()->pubseekoff(__off,__dir). And if that function fails, it sets failbit. rude but okay ๐Ÿ˜ญ

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().

References: std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::in, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate().


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

Changing the current read position. the other flavor of the same vibe ๐ŸŒธ

Parameters

  • __pos โ€” a file position object.

Returns

*this

If fail() is not true, it calls rdbuf()->pubseekpos(__pos). If that function fails, it sets failbit. same energy as before, different arg ๐Ÿซถ

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().

References: std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::in, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate().


fmtflags std::ios_base::setf(fmtflags __fmtfl)

[inline], [inherited] โ€” Setting new format flags. ๐Ÿ”ฅ

Parameters

  • __fmtfl โ€” additional flags to set.

Returns

The previous format control flags.

This one sets additional flags in format control, and here's the tea: flags that were previously set stay set. no clearing, no erasing, we're just adding ๐Ÿ’…

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


fmtflags std::ios_base::setf(fmtflags __fmtfl, fmtflags __mask)

[inline], [inherited] โ€” Setting new format flags. โœจ

Parameters

  • __fmtfl โ€” additional flags to set.
  • __mask โ€” the flags mask for __fmtfl.

Returns

The previous format control flags.

This version clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield. it's giving precision, it's giving control ๐ŸŽ€


void std::basic_ios<_CharT, _Traits>::setstate(iostate __state)

[inline], [inherited] โ€” Sets additional flags in the error state. ๐Ÿ’€

Parameters

  • __state โ€” the additional state flag(s) to set.

See std::ios_base::iostate for the possible bit values.

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), std::ws().

ngl that's a whole friend group showing up to the party ๐ŸŽ‰


int std::basic_istream<_CharT, _Traits>::sync(void)

Synchronizing the stream buffer. ๐Ÿฆ‹

Returns

0 on success, -1 on failure

Here's the flow, bestie:

  • If rdbuf() is a null pointer, it returns -1.
  • Otherwise, it calls rdbuf()->pubsync(), and if that returns -1, it sets badbit and returns -1.
  • Otherwise, it 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().

References: std::ios_base::badbit, std::ios_base::goodbit, std::basic_streambuf< _CharT, _Traits >::pubsync(), std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().


bool std::ios_base::sync_with_stdio(bool __sync = true)

[static], [inherited] โ€” Interaction with the standard C I/O objects. ๐ŸŒˆ

Parameters

  • __sync โ€” whether to synchronize or not.

Returns

True if the standard streams were previously synchronized.

The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary

iykyk โ€” this is the one people turn off for speed and then act surprised ๐Ÿ˜ญ


basic_istream< _CharT, _Traits >::pos_type std::basic_istream<_CharT, _Traits>::tellg(void)

Getting the current read position. โญ

Returns

A file position object.

If fail() is not false, it returns pos_type(-1) to indicate failure. Otherwise it 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. ๐Ÿ™ˆ

References: std::ios_base::badbit, std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::in, std::basic_ios< _CharT, _Traits >::rdbuf().


basic_ostream< _CharT, _Traits > * std::basic_ios<_CharT, _Traits>::tie() const

[inline], [nodiscard], [inherited] โ€” Fetches the current tied stream. ๐Ÿซถ

Returns

A pointer to the tied stream, or NULL if the stream is not tied.

So a stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream gets flushed first. For example, std::cin is tied to std::cout. iconic behavior, honestly ๐Ÿ‘‘

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and copyfmt().


basic_ostream< _CharT, _Traits > * std::basic_ios<_CharT, _Traits>::tie(basic_ostream< _CharT, _Traits > * __tiestr)

[inline], [inherited] โ€” Ties this stream to an output stream. ๐ŸŽ€

Parameters

  • __tiestr โ€” the output stream.

Returns

The previously tied output stream, or NULL if the stream was not tied.

This sets up a new tie; see tie() for more. besties are linked now ๐Ÿ’–


basic_istream< _CharT, _Traits > & std::basic_istream<_CharT, _Traits>::unget(void)

Unextracting the previous character. the rewind, the take-backsies ๐Ÿ’ซ

Returns

*this

Here's what goes down:

  • If rdbuf() is not null, it calls rdbuf()->sungetc(c).
  • If rdbuf() is null or if sungetc() fails, it 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.

References: _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_streambuf< _CharT, _Traits >::sungetc().

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


void std::ios_base::unsetf(fmtflags __mask)

[inline], [inherited] โ€” Clearing format flags. ๐Ÿงš

Parameters

  • __mask โ€” the flags to unset.

This function clears __mask in the format flags. the un-slay of flags, if you will ๐Ÿ’…


char_type std::basic_ios<_CharT, _Traits>::widen(char __c) const

[inline], [inherited] โ€” Widens characters. ๐ŸŒธ

Parameters

  • __c โ€” the character to widen.

Returns

The widened character.

It maps a character of char to a character of char_type. And it returns the result of

std::use_facet<ctype<char_type> >(getloc()).widen(c)

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html ๐ŸŒ

widen the vibe, bestie, the locale said so โœจ

Referenced by std::endl(), std::basic_ios< char_type, traits_type >::fill(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::getline(), std::getline(), std::getline(), std::operator<<(), std::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::tr2::operator>>().


streamsize std::ios_base::width () const โ€” [inline], [nodiscard], [inherited]

okay bestie this one is literally called Flags access and it's giving "how wide should my output be" energy โœจ

Returns

The minimum field width to generate on output operations. ๐ŸŽ€

And just so we're clear โ€” minimum field width means the number of characters. That's the unit. Characters. Not vibes. ๐Ÿ˜ญ

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().


streamsize std::ios_base::width (streamsize __wide) โ€” [inline], [inherited]

This is the Changing flags twin, the setter of the duo ๐Ÿ’…

Parameters

  • __wide โ€” the new width value, bestie. That's the whole assignment.

Returns

The previous value of width(). Not the new one. The old one. She remembers where you were before she changed. iconic behavior tbh ๐Ÿ‘‘


int std::ios_base::xalloc () โ€” [static], [inherited]

Access to unique indices โœจ and honestly this one is so underrated.

Returns

An integer different from all previous calls. every. single. time. no cap ๐Ÿซถ

This function returns a unique integer every time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. ๐Ÿฆ‹

The implementation maintains a static variable that is incremented and returned on each invocation. And xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays. slay, no notes ๐Ÿ’–


๐ŸŽ€ Member Data Documentation ๐ŸŽ€

okay these are the actual data members, the little variables living inside these classes. buckle up, there are a LOT of them and they're all lowkey important ๐Ÿ™ˆ


template<typename _CharT, typename _Traits> streamsize std::basic_istream< _CharT, _Traits >::_M_gcount โ€” [protected]

The number of characters extracted in the previous unformatted function; see gcount(). that's it, that's the whole job, she counts ๐Ÿงฎ

Referenced by get(), get(), get(), get(), ignore(), ignore(), ignore(), peek(), putback(), read(), readsome(), and unget().


const fmtflags std::ios_base::adjustfield โ€” [static], [inherited]

A mask of left|right|internal. Useful for the 2-arg form of setf. a little trio of alignment besties ๐Ÿ’…

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().


const openmode std::ios_base::app โ€” [static], [inherited]

Seek to end before each write. every write. she checks. she does not skip. ๐Ÿ“

Referenced by std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().


const openmode std::ios_base::ate โ€” [static], [inherited]

Open and seek to end immediately after opening. note the difference from app bestie โ€” ate does it once at open time, app does it before every single write. not the same girl, don't mix them up ๐Ÿ’€

Referenced by std::basic_filebuf< _CharT, _Traits >::open().


const iostate std::ios_base::badbit โ€” [static], [inherited]

Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). this is the bad one, the serious one, the "we are cooked" bit ๐Ÿ˜ญ

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, char_traits< _CharT > >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().


const fmtflags std::ios_base::basefield โ€” [static], [inherited]

A mask of dec|oct|hex. Useful for the 2-arg form of setf. your number base squad, choose your fighter ๐Ÿ”ข

Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().


const seekdir std::ios_base::beg โ€” [static], [inherited]

Request a seek relative to the beginning of the stream. back to the start, babes ๐ŸŽฌ

Referenced by std::basic_filebuf< _CharT, _Traits >::seekpos().


const openmode std::ios_base::binary โ€” [static], [inherited]

Perform input and output in binary mode (as opposed to text mode). And then the manpage hits you with this:

This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.

no fr bestie, go read that doc before you assume anything. the manpage is literally telling you your mental model is wrong ๐Ÿ’€

Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().


const fmtflags std::ios_base::boolalpha โ€” [static], [inherited]

Insert/extract bool in alphabetic rather than numeric format. so you get true/false instead of 1/0. she's fancy like that โœจ

Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().


const seekdir std::ios_base::cur โ€” [static], [inherited]

Request a seek relative to the current position within the sequence. right where you are, right now, no moving ๐Ÿซถ

Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().


const fmtflags std::ios_base::dec โ€” [static], [inherited]

Converts integer input or generates integer output in decimal base. the default one, the base-10 girlie, the one everyone uses without thinking ๐ŸŒธ

Referenced by std::dec(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.


const seekdir std::ios_base::end โ€” [static], [inherited]

Request a seek relative to the current end of the sequence. run to the back of the line ๐Ÿƒโ€โ™€๏ธ

Referenced by std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().


const iostate std::ios_base::eofbit โ€” [static], [inherited]

Indicates that an input operation reached the end of an input sequence. that's all folks, nothing left to read ๐ŸŽ€

Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, char_traits< _CharT > >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, char_traits< _CharT > >::seekg(), std::basic_istream< _CharT, _Traits >::unget(), std::basic_istream< _CharT, char_traits< _CharT > >::unget(), and std::ws().


const iostate std::ios_base::failbit โ€” [static], [inherited]

Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. not the catastrophic one like badbit, but still a fail, still a whole mood ๐Ÿ˜”

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), and std::basic_ostream< _CharT, _Traits >::seekp().


const fmtflags std::ios_base::fixed โ€” [static], [inherited]

Generate floating-point output in fixed-point notation. no exponents, just decimals, very demure ๐ŸŽ€

Referenced by std::fixed(), and std::hexfloat().


const fmtflags std::ios_base::floatfield โ€” [static], [inherited]

A mask of scientific|fixed. Useful for the 2-arg form of setf. the float formatting duo ๐Ÿ’…

Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().


const iostate std::ios_base::goodbit โ€” [static], [inherited]

Indicates all is well. ๐ŸŒˆโœจ zero problems, zero drama, the stream is thriving, she ate and left no crumbs ๐Ÿ‘‘


okay we're still going, bestie โ€” the data members keep coming and they do not stop ๐Ÿ’œ

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().

  • const fmtflags std::ios_base::hex [static], [inherited] โ€” Converts integer input or generates integer output in hexadecimal base. Hex girl summer ๐Ÿ”ฅ

Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::hex().

  • const openmode std::ios_base::in [static], [inherited] โ€” Open for input. Default for ifstream and fstream. Come on in, the water's fine ๐Ÿ’™

Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_stringbuf< char >::basic_stringbuf(), std::basic_stringstream< char >::basic_stringstream(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_streambuf< char_type, traits_type >::pubseekoff(), std::basic_streambuf< char_type, traits_type >::pubseekpos(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_streambuf< char_type, traits_type >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< char >::seekoff(), std::basic_streambuf< char_type, traits_type >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::seekpos(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< char >::showmanyc(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().

  • const fmtflags std::ios_base::internal [static], [inherited] โ€” Adds fill characters at a designated internal point in certain generated output, or identical to right if no such point is designated. Internal affairs ๐Ÿ’œ

Referenced by std::internal().

  • const fmtflags std::ios_base::left [static], [inherited] โ€” Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.). Left, left, left, right, left ๐ŸŽถ

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::left(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.

  • const fmtflags std::ios_base::oct [static], [inherited] โ€” Converts integer input or generates integer output in octal base. Oct-oct-oct ๐Ÿ™

Referenced by std::oct().

  • const openmode std::ios_base::out [static], [inherited] โ€” Open for output. Default for ofstream and fstream. Out and about ๐Ÿ’š

Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringbuf< char >::basic_stringbuf(), std::basic_stringstream< char >::basic_stringstream(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_streambuf< char_type, traits_type >::pubseekoff(), std::basic_streambuf< char_type, traits_type >::pubseekpos(), std::basic_streambuf< char_type, traits_type >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< char >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_streambuf< char_type, traits_type >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::basic_filebuf< _CharT, _Traits >::xsputn().

  • const fmtflags std::ios_base::right [static], [inherited] โ€” Adds fill characters on the left (initial positions) of certain generated output. (I.e., the thing you print is flush right.). Right on ๐Ÿ’–

Referenced by std::right().

  • const fmtflags std::ios_base::scientific [static], [inherited] โ€” Generates floating-point output in scientific notation. Science slay ๐Ÿงช

Referenced by std::hexfloat(), and std::scientific().

  • const fmtflags std::ios_base::showbase [static], [inherited] โ€” Generates a prefix indicating the numeric base of generated integer output. Show it off ๐Ÿ’…

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::noshowbase(), and std::showbase().

  • const fmtflags std::ios_base::showpoint [static], [inherited] โ€” Generates a decimal-point character unconditionally in generated floating-point output. Point made โœจ

Referenced by std::noshowpoint(), and std::showpoint().

  • const fmtflags std::ios_base::showpos [static], [inherited] โ€” Generates a + sign in non-negative generated numeric output. Positivity only โ˜€๏ธ

Referenced by std::noshowpos(), and std::showpos().

  • const fmtflags std::ios_base::skipws [static], [inherited] โ€” Skips leading white space before certain input operations. Space? Don't know her ๐Ÿšซ

Referenced by std::noskipws(), std::__detail::operator>>(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, and std::skipws().

  • const openmode std::ios_base::trunc [static], [inherited] โ€” Truncate an existing stream when opening. Default for ofstream. Cut it off โœ‚๏ธ
  • const fmtflags std::ios_base::unitbuf [static], [inherited] โ€” Flushes output after each output operation. Flush it out ๐Ÿ’ง

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().

  • const fmtflags std::ios_base::uppercase [static], [inherited] โ€” Replaces certain lowercase letters with their uppercase equivalents in generated output. LOUDER ๐Ÿ“ข

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::nouppercase(), and std::uppercase().


Author ๐Ÿ’–

Generated automatically by Doxygen for libstdc++ from the source code. No cap, that's literally what it says.

And that's a wrap on std::basic_istream< _CharT, _Traits >, bestie. The footer says libstdc++ and the manpage title std::basic..., _Traits >(3). No date shown, but we're timeless anyway. Byeee ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms