STD::IFSTREAM(3cxx)

πŸŽ€ NAME

std::basic_ifstream< _CharT, _Traits > from the 3cxx manual β€” controlling input for files, bestie. That's the whole vibe: it's your file-input stream, and this page is its whole little world. πŸ’–


🌸 SYNOPSIS

#include <fstream>

Inherits std::basic_istream< _CharT, _Traits >. slay, it's giving "istream but make it files." ✨

🧚 Public Types

  • typedef ctype< _CharT > __ctype_type
  • typedef basic_filebuf< char_type, traits_type > __filebuf_type
  • typedef basic_ios< _CharT, _Traits > __ios_type
  • typedef basic_istream< char_type, traits_type > __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.
  • typedef void(* event_callback) (event __e, ios_base &__b, int __i) β€” the type of an event callback function.
  • typedef _Ios_Fmtflags fmtflags β€” this is a bitmask type.
  • typedef traits_type::int_type int_type
  • typedef _Ios_Iostate iostate β€” this is a bitmask type.
  • typedef traits_type::off_type off_type
  • typedef _Ios_Openmode openmode β€” this is a bitmask type.
  • typedef traits_type::pos_type pos_type
  • typedef _Ios_Seekdir seekdir β€” this is an enumerated type.
  • typedef _Traits traits_type
  • typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_type

πŸ’… Public Member Functions

okay so this is the big roster, and every single one is here because we do not skip details. 🫢

  • basic_ifstream () β€” default constructor.
  • basic_ifstream (basic_ifstream &&__rhs)
  • template<typename _Path , typename _Require = _If_fs_path<_Path>> basic_ifstream (const _Path &__s, ios_base::openmode __mode=ios_base::in) β€” create an input file stream.
  • basic_ifstream (const basic_ifstream &)=delete
  • basic_ifstream (const char *__s, ios_base::openmode __mode=ios_base::in) β€” create an input file stream.
  • basic_ifstream (const std::string &__s, ios_base::openmode __mode=ios_base::in) β€” create an input file stream.
  • ~basic_ifstream () β€” the destructor does nothing. yes bestie, it literally just vibes.
  • 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.
  • void clear (iostate __state=goodbit) β€” [re]sets the error state.
  • void close () β€” close the file.
  • basic_ios & copyfmt (const basic_ios &__rhs) β€” copies fields of __rhs into this.
  • 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.
  • 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.
  • streamsize gcount () const β€” character counting.
  • basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim) β€” explicit specialization declarations, defined in src/istream.cc.
  • basic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)
  • locale getloc () const β€” locale access.
  • bool good () const β€” fast error checking.
  • 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)
  • locale imbue (const locale &__loc) β€” moves to a new locale.
  • bool is_open () β€” wrapper to test for an open file.
  • bool is_open () const
  • long & iword (int __ix) β€” access to integer array.
  • char narrow (char_type __c, char __dfault) const β€” squeezes characters.
  • template<typename _Path > _If_fs_path< _Path, void > open (const _Path &__s, ios_base::openmode __mode=ios_base::in) β€” opens an external file.
  • void open (const char *__s, ios_base::openmode __mode=ios_base::in) β€” opens an external file.
  • void open (const std::string &__s, ios_base::openmode __mode=ios_base::in) β€” opens an external file.
  • basic_ifstream & operator= (basic_ifstream &&__rhs)
  • basic_ifstream & operator= (const basic_ifstream &)=delete
  • __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.
  • __filebuf_type * 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.
  • void swap (basic_ifstream &__rhs)
  • 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.
  • 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.

also these three manipulator operator>> besties are right here, same energy:

  • __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

okay so all the operator>> functions β€” aka the formatted input functions β€” share some common behavior. Each one starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to false. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more. iykyk. πŸ¦‹

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. periodt, that part matters. πŸ’€

  • __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

all the unformatted input functions also 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. not me knowing the sentry lore by heart. ✨

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 caveat, same drama, same exact meaning. πŸ’œ

  • 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.
  • int_type peek () β€” looking ahead in the stream.
  • __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.
  • __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, bestie. πŸ’…
  • bool operator! () const β€” same quick-and-easy status check, just with the negate button pressed. 😭

✨ 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 β€” the source lists it with no extra description, so we respect the mystery. 🫢
  • static const fmtflags adjustfield β€” a mask of left|right|internal. Useful for the 2-arg form of setf.
  • static const openmode app β€” seek to end before each write.
  • static const openmode ate β€” open and seek to end immediately after opening.
  • static const iostate badbit β€” indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file).
  • static const fmtflags basefield β€” a mask of dec|oct|hex. Useful for the 2-arg form of setf.
  • static const seekdir beg β€” request a seek relative to the beginning of the stream.
  • 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.
  • static const fmtflags boolalpha β€” insert/extract bool in alphabetic rather than numeric format.
  • static const seekdir cur β€” request a seek relative to the current position within the sequence.
  • 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.
  • 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.
  • static const fmtflags fixed β€” generate floating-point output in fixed-point notation.
  • static const fmtflags floatfield β€” a mask of scientific|fixed. Useful for the 2-arg form of setf.
  • static const iostate goodbit β€” indicates all is well.
  • static const fmtflags hex β€” converts integer input or generates integer output in hexadecimal base.
  • static const openmode in β€” open for input. 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. 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.
  • 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.
  • 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. Default for ofstream.
  • 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.

πŸ¦‹ Protected Types πŸ¦‹

  • enum { _S_local_word_size } β€” the one protected type listed, and yes, that's the whole vibe. 🐚

πŸ’œ Protected Member Functions πŸ’œ

  • void _M_cache_locale (const locale &__loc) β€” behind-the-scenes helper, listed with no extra description in the source.
  • void _M_call_callbacks (event __ev) throw () β€” behind-the-scenes helper, listed with no extra description in the source.
  • void _M_dispose_callbacks (void) throw () β€” behind-the-scenes helper, listed with no extra description in the source.
  • template<typename _ValueT > __istream_type & _M_extract (_ValueT &__v) β€” behind-the-scenes helper, listed with no extra description in the source.
  • _Words & _M_grow_words (int __index, bool __iword) β€” behind-the-scenes helper, listed with no extra description in the source.
  • void _M_init () throw () β€” behind-the-scenes helper, listed with no extra description in the source.
  • void _M_move (ios_base &) noexcept β€” behind-the-scenes helper, listed with no extra description in the source.
  • void _M_swap (ios_base &__rhs) noexcept β€” behind-the-scenes helper, listed with no extra description in the source.
  • void init (basic_streambuf< _CharT, _Traits > *__sb) β€” all setup is performed here. ✨
  • void move (basic_ios &&__rhs) β€” listed with no extra description in the source.
  • void move (basic_ios &__rhs) β€” listed with no extra description in the source.
  • void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb) β€” listed with no extra description in the source.
  • void swap (basic_ios &__rhs) noexcept β€” listed with no extra description in the source.
  • void swap (basic_istream &__rhs) β€” listed with no extra description in the source.

🌸 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

🌈 Detailed Description 🌈

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

Controlling input for files. πŸ‘‘

Template Parameters

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

This class supports reading from named files, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as sb. 🫢

🧚 Member Typedef Documentation 🧚

__num_put_type (inherited)

typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_put_type

These are non-standard types. πŸ‘€

event_callback (inherited)

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

The type of an event callback function. πŸ’«

Parameters

  • __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(). πŸŽ€

fmtflags (inherited)

typedef _Ios_Fmtflags std::ios_base::fmtflags

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

iostate (inherited)

typedef _Ios_Iostate std::ios_base::iostate

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

openmode (inherited)

typedef _Ios_Openmode std::ios_base::openmode

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

seekdir (inherited)

typedef _Ios_Seekdir std::ios_base::seekdir

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(). πŸ’…

🌸 Constructor & Destructor Documentation 🌸

basic_ifstream ()

template<typename _CharT, typename _Traits>
std::basic_ifstream< _CharT, _Traits >::basic_ifstream () [inline]

Default constructor. Initializes sb using its default constructor, and passes &sb to the base class initializer. Does not open any files (you haven't given it a filename to open). 😌

References std::basic_ios< _CharT, _Traits >::init().

basic_ifstream (const char * __s, ios_base::openmode __mode = ios_base::in)

template<typename _CharT, typename _Traits>
std::basic_ifstream< _CharT, _Traits >::basic_ifstream (const char * __s, ios_base::openmode __mode = ios_base::in) [inline],  [explicit]

Create an input file stream. πŸŽ€

Parameters

  • __s β€” null terminated string specifying the filename.
  • __mode β€” open file in specified mode (see std::ios_base).

ios_base::in is automatically included in __mode.

References std::basic_ios< _CharT, _Traits >::init(), and std::basic_ifstream< _CharT, _Traits >::open().

basic_ifstream (const std::string & __s, ios_base::openmode __mode = ios_base::in)

template<typename _CharT, typename _Traits>
std::basic_ifstream< _CharT, _Traits >::basic_ifstream (const std::string & __s, ios_base::openmode __mode = ios_base::in) [inline],  [explicit]

Create an input file stream. πŸ’–

Parameters

  • __s β€” std::string specifying the filename.
  • __mode β€” open file in specified mode (see std::ios_base).

ios_base::in is automatically included in __mode.

References std::basic_ios< _CharT, _Traits >::init(), and std::basic_ifstream< _CharT, _Traits >::open().

basic_ifstream (const _Path & __s, ios_base::openmode __mode = ios_base::in)

template<typename _CharT, typename _Traits>
template<typename _Path , typename _Require  = _If_fs_path<_Path>>
std::basic_ifstream< _CharT, _Traits >::basic_ifstream (const _Path & __s, ios_base::openmode __mode = ios_base::in) [inline]

Create an input file stream. πŸ¦‹

Parameters

  • __s β€” filesystem::path specifying the filename.
  • __mode β€” open file in specified mode (see std::ios_base).

ios_base::in is automatically included in __mode.

~basic_ifstream ()

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

The destructor does nothing. The file is closed by the filebuf object, not the formatting stream. πŸ’€

πŸ‘‘ Member Function Documentation πŸ‘‘

_M_getloc ()

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

Locale access. 🫢

Returns

  • A reference to the current locale.

Like getloc above, but returns a reference instead of generating a copy. ✨

  • std::time_put< _CharT, _OutIter >::do_put()
    • std::time_get< _CharT, _InIter >::get()
    • std::time_put< _CharT, _OutIter >::put()

ngl bestie that is a whole list, but it's giving "everyone wants a piece of this function" πŸ’…

  • template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [inherited] β€” Fast error checking ✨

Returns: True if the badbit is set.

Heads up: other iostate flags may also be set, so don't assume it's just the one, okay? πŸ™ˆ

References: std::ios_base::badbit, and std::basic_ios< _CharT, _Traits >::rdstate().

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 πŸŽ€

Parameters:

  • __state β€” the new state flag(s) you wanna set.

See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument β€” it's lowkey optional-optional, bestie.

Referenced by: std::basic_ios< _CharT, _Traits >::exceptions(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::__detail::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().

(Yes, open() really is in there three times for the file streams. Not a typo on my end β€” it is exactly like that in the docs. πŸ’€)

  • template<typename _CharT , typename _Traits > void std::basic_ifstream< _CharT, _Traits >::close () [inline] β€” Close the file πŸ”’

Calls std::basic_filebuf::close(). If that function fails, failbit is set in the stream's error state. So if it doesn't slay, the stream will be told about it, fr fr.

References: std::basic_filebuf< _CharT, _Traits >::close(), std::ios_base::failbit, and std::basic_ios< _CharT, _Traits >::setstate().

  • 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 ✨ the glow-up transfer

Parameters:

  • __rhs β€” the source values for the copies.

Returns: Reference to this object.

So here's the tea πŸ“: all fields of __rhs are copied into this object except that rdbuf() and rdstate() remain unchanged. All values in the pword and iword arrays are copied. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions(). It's giving "makeover montage, but make it a callback sequence" πŸ’…

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

  • template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [inherited] β€” Fast error checking 🌸

Returns: True if the eofbit is set.

Again, other iostate flags may also be set. Iconic of them to multitask.

References: std::ios_base::eofbit, and std::basic_ios< _CharT, _Traits >::rdstate().

  • template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [inherited] β€” Throwing exceptions on errors 😭

Returns: The current exceptions mask.

This changes nothing in the stream. No cap. See the one-argument version of exceptions(iostate) for the meaning of the return value.

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt().

  • 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.

By default, error flags are set silently 🀫. 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.

⚠️ Big one, bestie: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. No waiting, no warning, just vibes and then 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);
}

References: std::basic_ios< _CharT, _Traits >::clear().

  • template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [inherited] β€” Fast error checking πŸ’€

Returns: True if either the badbit or the failbit is set.

Checking the badbit in fail() is historical practice β€” iykyk, it's just how the elders did it. Note that other iostate flags may also be set.

References: std::ios_base::badbit, std::ios_base::failbit, and std::basic_ios< _CharT, _Traits >::rdstate().

Referenced by: std::basic_ios< _CharT, _Traits >::operator bool(), std::basic_ios< _CharT, _Traits >::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(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::regex_traits< _Ch_type >::value().

  • template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [inherited] β€” Retrieves the empty character πŸŽ€

Returns: The current fill character.

It defaults to a space (' ') in the current locale. Cute, simple, classic.

References: std::basic_ios< _CharT, _Traits >::widen().

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), and std::basic_ios< _CharT, _Traits >::fill().

  • 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. (So it hands you the old one back like "here, you'll want this.")

The fill character is used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale.

References: std::basic_ios< _CharT, _Traits >::fill().

  • fmtflags std::ios_base::flags () const [inline], [inherited] β€” Access to format flags 🌈

Returns: The format control flags for both input and output.

Referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), 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::normal_distribution< double >::operator()(), std::operator<<(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::operator>>().

That's a lot of operator>>()s and I'm not apologizing for them β€” they're all in the original 🫢

  • 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.

This function overwrites all the format flags with __fmtfl. It's a full reset, not a merge β€” don't come for me, that's literally what it does.

  • template<typename _CharT , typename _Traits > streamsize std::basic_istream< _CharT, _Traits >::gcount () const [inline], [inherited] β€” Character counting πŸ”’

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

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

  • template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::get (void) [inherited] β€” Simple extraction πŸ“

Returns: A character, or eof().

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

References: std::basic_istream< _CharT, _Traits >::_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< _CharT, _Traits >::get(), and std::basic_istream< _CharT, _Traits >::get().

  • template<typename _CharT , typename _Traits > __istream_type & std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb) [inline], [inherited] β€” Extraction into another streambuf πŸ¦‹

Parameters:

  • __sb β€” a streambuf in which to store data.

Returns: *this

Returns get(__sb,widen('\n')). Short, sweet, delegates the whole thing.

References: std::basic_istream< _CharT, _Traits >::get(), and std::basic_ios< _CharT, _Traits >::widen().

  • template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb, char_type __delim) [inherited] β€” Extraction into another streambuf ✨ with a stop character

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. Little heads up so you're not confused when it happens 🫢

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

  • template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type & __c) [inherited] β€” 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. So don't @ me when your signed char doesn't match β€” it was never invited to the party πŸ’€

References: std::basic_istream< _CharT, _Traits >::_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(char_type *__s, streamsize __n) β€” [inline], [inherited]

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

Simple multiple-character extraction, bestie. It's the easygoing version.

Parameters

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

Returns

*this

Literally just returns get(__s,__n,widen('\n')).

References: std::basic_istream< _CharT, _Traits >::get(), and std::basic_ios< _CharT, _Traits >::widen().


πŸ¦‹ get(char_type *__s, streamsize __n, char_type __delim) β€” [inherited]

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

Simple multiple-character extraction, but now with a stop character in the mix ✨

Parameters

  • __s β€” Pointer to an array.
  • __n β€” Maximum number of characters to store in __s.
  • __delim β€” A 'stop' character.

Returns

*this

So here's the tea: characters get extracted and stored into __s until one of these 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. Kind of rude but okay.

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. Just so you know πŸ‘‘

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


πŸŽ€ getline(char_type *__s, streamsize __n) β€” [inline], [inherited]

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

String extraction, the low-effort iconique version.

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

References: std::basic_istream< _CharT, _Traits >::getline(), and std::basic_ios< _CharT, _Traits >::widen().


πŸ’… getline(char_type *__s, streamsize __n, char_type __delim) β€” [inherited]

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

String extraction, full send.

Parameters

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

Returns

*this

Extracts and stores characters into __s until one of the following happens. And heads up β€” these criteria are required to be tested in the order listed here, so an input line can exactly fill the __s array without setting failbit. Order matters, no cap.

  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. She said what she said 🫢)

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

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


🌈 std::basic_istream< char >::getline(char_type *__s, streamsize __n, char_type __delim) β€” [inherited]

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

Explicit specialization declarations, defined in src/istream.cc. That's it, that's the whole vibe πŸ’€


⭐ std::ios_base::getloc() β€” [inline], [inherited]

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

Locale access. Giving you the locale lore.

Returns

A copy of the current locale.

If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale.

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


πŸ”₯ good() β€” [inline], [inherited]

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

Fast error checking. Snappy little vibe check for your stream.

Returns

True if no error flags are set.

It's literally a wrapper around rdstate.

References: std::basic_ios< _CharT, _Traits >::rdstate().

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


πŸ“ ignore(void) β€” [inherited]

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

Simple extraction. (Yes, the description says "extraction" for a function called ignore β€” I don't make the rules, I just report them ✨)

Returns

A character, or eof().

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

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


🧚 ignore(streamsize __n) β€” [inherited]

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

Simple extraction, again. Same energy as above, different signature.

Returns

A character, or eof().

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

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


πŸ’œ ignore(streamsize __n, int_type __delim) β€” [inherited]

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

Discarding characters. This is the main character of the ignore family, honestly πŸ‘‘

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 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. Efficient and law-abiding, we love to see it πŸ’…

πŸŽ€ imbue(const locale &__loc) β€” [inherited]

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

Moves to a new locale. Glow-up for your stream's language settings 🌍

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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

References: std::ios_base::imbue().

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


🌸 init(basic_streambuf< _CharT, _Traits > *__sb) β€” [protected], [inherited]

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. Not up for debate, bestie πŸ™ˆ

Referenced by β€” okay this list is a lot, but every single one of them matters:

  • std::basic_fstream< _CharT, _Traits >::basic_fstream() (listed three times in the original πŸ’€)
  • std::basic_ifstream< _CharT, _Traits >::basic_ifstream() (also three times)
  • std::basic_ios< _CharT, _Traits >::basic_ios()
  • std::basic_istream< _CharT, _Traits >::basic_istream()
  • std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream() (three times, yes)
  • std::basic_ofstream< _CharT, _Traits >::basic_ofstream() (three times)
  • std::basic_ostream< _CharT, _Traits >::basic_ostream()
  • std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream() (three times)
  • std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream() (three times)

Every single constructor out here relying on init. Main character energy fr fr.


πŸ¦‹ is_open() β€” [inline]

template<typename _CharT , typename _Traits >
bool std::basic_ifstream< _CharT, _Traits >::is_open () [inline]

Wrapper to test for an open file. Tiny function, huge responsibilities.

Returns

rdbuf()->is_open()

References: std::basic_filebuf< _CharT, _Traits >::is_open().


πŸ’– std::ios_base::iword(int __ix) β€” [inline], [inherited]

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

Access to integer array. It's giving "grab bag of numbers" πŸŽ€

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. Like, do not get attached. It will move on without you 😭


🌺 narrow(char_type __c, char __dfault) β€” [inline], [inherited]

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

Squeezes characters. Compression but make it localization ✨

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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html


🧚 open(const _Path &__s, ios_base::openmode __mode = ios_base::in) β€” [inline]

template<typename _CharT , typename _Traits > template<typename _Path >
_If_fs_path< _Path, void > std::basic_ifstream< _CharT, _Traits >::open
(const _Path & __s, ios_base::openmode __mode = ios_base::in) [inline]

Opens an external file. Doors unlocked, bestie πŸšͺ✨

Parameters

  • __s β€” The name of the file, as a filesystem::path.
  • __mode β€” The open mode flags.

Calls std::basic_filebuf::open(__s,__mode|in). If that function fails, failbit is set in the stream's error state.

References: std::basic_ifstream< _CharT, _Traits >::open().

πŸ’… open β€” the const char* version

template<typename _CharT , typename _Traits > void std::basic_ifstream< _CharT, _Traits >::open (const char * __s, ios_base::openmode __mode = ios_base::in) [inline]

Okay so this is the moment β€” you're actually opening an external file, bestie. Like, committing. πŸŽ€

Parameters

  • __s β€” the name of the file, i.e. the whole point
  • __mode β€” the open mode flags

Under the hood it calls std::basic_filebuf::open(s,__mode|in). And if that function fails? failbit gets set in the stream's error state. So like, your stream is officially Not Okay and it tells you. 😭

References: std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::failbit, std::ios_base::in, std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_ios< _CharT, _Traits >::setstate().

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


🌸 open β€” the std::string version

template<typename _CharT , typename _Traits > void std::basic_ifstream< _CharT, _Traits >::open (const std::string & __s, ios_base::openmode __mode = ios_base::in) [inline]

Same vibes, but you get to pass a std::string instead of a raw const char* β€” she's flexible like that. πŸ’… Opens an external file, periodt.

Parameters

  • __s β€” the name of the file
  • __mode β€” the open mode flags

This one calls std::basic_filebuf::open(__s,__mode|in). If that function fails, failbit is set in the stream's error state. Same glow-up, same heartbreak potential. πŸ’€

References: std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::failbit, std::ios_base::in, std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_ios< _CharT, _Traits >::setstate().


✨ operator bool() β€” the quick-and-easy status check

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

This is genuinely the icon of convenience β€” the quick-and-easy status check. It's what lets you write constructs such as if (!a_stream) ... and while (a_stream) ... without wanting to scream. 🫢

Note she's explicit, so no sneaky implicit conversions β€” she's got boundaries, and honestly? Respect.

References: std::basic_ios< _CharT, _Traits >::fail().


πŸ¦‹ operator!() β€” the other quick-and-easy status check

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

Yep, it's the same quick-and-easy status check, just the ! flavoured one. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... β€” the classic combo. ⭐

References: std::basic_ios< _CharT, _Traits >::fail().


πŸŽ€ operator>> β€” the manipulator interface, version 1

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

Interface for manipulators, bestie. 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. 🧚


🌈 operator>> β€” the manipulator interface, version 2

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

Again, 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. Yeah she has a twin, it's giving sibling energy. πŸ‘‘


πŸ’œ operator>> β€” extracting into another streambuf

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

Extracting into another streambuf β€” very main character energy. πŸ’…

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. So like. don't do that. πŸ™ˆ

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


πŸ”₯ operator>> (bool&) β€” integer arithmetic extractor

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

Integer arithmetic extractors. Yes, bool lives in this club, don't question it.

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. Locale-aware parsing, we love to see it. 🌟


πŸ“ operator>> (double&) β€” floating point arithmetic extractor

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

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. Decimals, slay. ✨


πŸ¦‹ operator>> (float&) β€” floating point arithmetic extractor

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

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. Same as her double sister, just a lil smaller. πŸŽ€


⭐ operator>> (int&) β€” integer arithmetic extractor

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

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. The classic int. The blueprint, honestly. πŸ’…


🌈 operator>> β€” the ios_base manipulator interface

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

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. Third sibling, equally iconic. πŸ‘‘


πŸ’– operator>> (long&) β€” integer arithmetic extractor

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

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. Long math, long hair, don't care. πŸ’


🧚 operator>> (long double&) β€” floating point arithmetic extractor

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

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. Big precision energy. MASSIVE. πŸ”₯


πŸ’œ operator>> (long long&) β€” integer arithmetic extractor

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

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. She goes long AND long, double the commitment. 😀


πŸŽ€ operator>> (short&) β€” integer arithmetic extractor (she has receipts!)

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

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::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::setstate(). The short one's got extra state drama, ngl. πŸ’€


πŸ¦‹ operator>> (unsigned int&) β€” integer arithmetic extractor

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

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. No negativity allowed. πŸ’…


πŸ“ operator>> (unsigned long&) β€” integer arithmetic extractor

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

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. Positivity only in this house. 🌸


πŸ‘‘ operator>> (unsigned long long&) β€” integer arithmetic extractor

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

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. Unsigned AND long AND long β€” she simply has range. 🌈


✨ operator>> (unsigned short&) β€” integer arithmetic extractor

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

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. Small but unsigned, she's thriving. 🫢


🌟 operator>> (void*&) β€” the basic arithmetic extractor

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

Basic arithmetic extractors. Yeah, a pointer walked into the arithmetic club, she said "let me in". πŸ’€

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. Pointing at things, locale-aware, iconic. πŸ”₯


🌸 peek β€” looking ahead in the stream

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

Looking ahead in the stream. Not extracting, just πŸ‘€. Respecting the character's privacy.

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. She's just window shopping bestie, she doesn't buy. πŸ›οΈ

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


πŸŽ€ precision() β€” flags access

streamsize std::ios_base::precision () const [inline],  [inherited]

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. ⚠️ Like, genuinely, don't get cute with redefining this one.

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


πŸ’… precision(streamsize) β€” changing flags

streamsize std::ios_base::precision (streamsize __prec) [inline],  [inherited]

Changing flags.

Parameters

  • __prec β€” the new precision value

Returns: the previous value of precision(). So you can always put it back, we love a reversible queen. 🫢


πŸ¦‹ putback β€” unextracting a single character

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

Unextracting a single character. Yes, that's a real word here. She's putting it back where she found it, very respectful. πŸ’…

Parameters

  • __c β€” the character to push back into the input stream
  • Returns β€” *this

If rdbuf() isn't a null pointer, it calls rdbuf()->sputbackc(c).

If rdbuf() is null, or if sputbackc() just straight-up fails, it sets badbit in the error state. πŸ’€

Note β€” this function first clears eofbit. And because no characters actually get extracted, the next call to gcount() will return 0, which is exactly what DR 60 demands. no cap.

References: std::basic_istream< _CharT, _Traits >::_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<<().


🌸 void *& std::ios_base::pword (int __ix) [inline], [inherited]

Access to the void pointer array. literally a whole little array of void* and you can just... vibe in it.

Parameters

  • __ix β€” index into the array.

Returns

A reference to a void* associated with the index.

So the pword function gives you access to an array of pointers that you can use for any purpose whatsoever. The array grows as required to hold whatever index you supply, and all pointers in the array are initialized to 0. πŸŽ€

The implementation reserves several indices for itself, so you should use xalloc to grab an index that's actually safe for you to use. Also β€” and this is the part that gets people β€” since the array can grow dynamically, it is not safe to hold onto that reference. πŸ™ˆ

πŸ¦‹ template<typename _CharT , typename _Traits > __filebuf_type * std::basic_ifstream< _CharT, _Traits >::rdbuf () const [inline]

Accessing the underlying buffer.

Returns

The current basic_filebuf buffer.

Fun fact: this one hides both signatures of std::basic_ios::rdbuf(). icon behavior, honestly. πŸ‘‘

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

Changing the underlying buffer.

Parameters

  • __sb β€” the new stream buffer.

Returns

The previous stream buffer.

This associates a new buffer with the current stream, and clears the error state. πŸ’…

Okay so here's the messy lore: due to historical accidents which the LWG refuses to correct 😭, the I/O library suffers from a genuine design error β€” this function gets 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. Like this, bestie:

std::fstream     foo;         // or some other derived type
std::streambuf*  p = .....;

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

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

Returns the error state of the stream buffer.

Returns

A bit pattern (well, isn't everything?)

Check std::ios_base::iostate for the possible bit values. Most users will just call one of the interpreting wrappers instead, e.g. good().

Referenced by: std::basic_ios< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::eof(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ios< _CharT, _Traits >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().

πŸ’œ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::read (char_type * __s, streamsize __n) [inherited]

Extraction without delimiters. raw. unfiltered. no separator drama. πŸ”₯

Parameters

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

Returns

*this

If the stream state is good(), it extracts characters and stores them into __s until one of these 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. just so you know. πŸ™ˆ

References: std::basic_istream< _CharT, _Traits >::_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().

πŸ“ template<typename _CharT , typename _Traits > streamsize std::basic_istream< _CharT, _Traits >::readsome (char_type * __s, streamsize __n) [inherited]

Extraction until the buffer is exhausted, but no more. it's giving "I'll take what's already here and I will NOT be requesting more." 🧚

Parameters

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

Returns

The number of characters extracted.

It extracts characters and stores them into __s depending on how many characters are left in the streambuf's buffer, rdbuf()->in_avail() β€” which we're calling 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 whole goal is to empty the current buffer and to not request any more from the external input sequence controlled by the streambuf. periodt. ✨

References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::goodbit, std::min(), std::basic_ios< _CharT, _Traits >::rdbuf(), and 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 it's invoked.

It registers a function as an event callback, with an integer parameter that gets passed to the function when it's invoked. Multiple copies of the same function are allowed (yes, really), and if there are multiple callbacks, they get invoked in the order they were registered. 🫢

πŸ¦‹ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::seekg (off_type __off, ios_base::seekdir __dir) [inherited]

Changing the current read 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). If that function fails, it 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().

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(), and std::basic_ios< _CharT, _Traits >::setstate().

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

Changing the current read position. the other flavor. πŸ“

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.

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(), and 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 function sets additional flags in format control, and flags that were previously set stay set. main character energy, it doesn't clear the room. πŸ‘‘

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

πŸ’… fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited]

Setting new format flags. the masked edition.

Parameters

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

Returns

The previous format control flags.

This one clears the mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield. slay.

πŸ”₯ template<typename _CharT , typename _Traits > 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.

References: std::basic_ios< _CharT, _Traits >::clear(), and std::basic_ios< _CharT, _Traits >::rdstate().

Referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ifstream< _CharT, _Traits >::close(), std::basic_ofstream< _CharT, _Traits >::close(), std::basic_fstream< _CharT, _Traits >::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_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::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(), and std::ws().

(like, literally everyone calls this one. it's the popular girl of the error state functions. πŸ’–)

🌈 template<typename _CharT , typename _Traits > int std::basic_istream< _CharT, _Traits >::sync (void) [inherited]

Synchronizing the stream buffer.

Returns

0 on success, -1 on failure

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 β€” and this is the good timeline β€” 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(), and std::basic_ios< _CharT, _Traits >::setstate().


🌈 static bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]

Okay bestie, this one is literally the bridge between your C era and your C++ era β€” it's all about interaction with the standard C I/O objects. πŸ’«

Parameters

  • __sync β€” whether to synchronize or not.

Returns

true if the standard streams were previously synchronized. No cap.

And listen, 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 β€” they're off living their own life, okay? πŸ™ˆ

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary for the full tea. 🫢


⭐ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits >::pos_type std::basic_istream< _CharT, _Traits >::tellg (void) [inherited]

Getting the current read position β€” like checking where the cursor is chilling. πŸ“

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). That's the whole vibe.

Note: This function does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount(). And 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, and std::basic_ios< _CharT, _Traits >::rdbuf().


πŸŽ€ template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [inherited]

Fetches the current tied stream. It's giving "who's your plus-one" energy. πŸ’…

Returns

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

So here's the lore: a stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream is first flushed. For example, std::cin is tied to std::cout. Iconic behavior, honestly. ✨

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


πŸ’– template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie (basic_ostream< _CharT, _Traits > * __tiestr) [inline], [inherited]

Ties this stream to an output stream. Officially making it official. 🫢

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() above for more. (Yes, same name β€” it's a whole overload moment, we love to see it.) πŸ’€


πŸ¦‹ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::unget (void) [inherited]

Unextracting the previous character β€” the ultimate "nvm, put it back" move. 😭

Returns

*this

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. That's the bad ending, bestie. πŸ’€

Note: This function first clears eofbit. And since no characters are extracted, the next call to gcount() will return 0, as required by DR 60. Rules are rules. πŸ“œ

References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdstate().

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


🌸 void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited]

Clearing format flags. The "unsubscribe" button of format flags, fr fr. 🧹

Parameters

  • __mask β€” the flags to unset.

This function clears __mask in the format flags. That's it, that's the whole function, and honestly? We stan a low-maintenance icon. πŸ‘‘


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

Widens characters. Glow-up for a single char. ✨

Parameters

  • __c β€” the character to widen.

Returns

The widened character.

It maps a character of char to a character of char_type.

Returns the result of

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

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html β€” go read up, it's giving global citizen. 🌍

Referenced by std::endl(), std::basic_ios< _CharT, _Traits >::fill(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::getline(), std::operator<<(), std::operator<<(), and std::tr2::operator>>().


🌺 streamsize std::ios_base::width () const [inline], [inherited]

Flags access. Getting the deets. πŸ”

Returns

The minimum field width to generate on output operations.

And minimum field width refers to the number of characters. Not pixels, not vibes β€” characters. πŸ’…

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]

Changing flags. The setter edition, we love a sequel. 🎬

Parameters

  • __wide β€” the new width value.

Returns

The previous value of width().


πŸ”₯ static int std::ios_base::xalloc () [static], [inherited]

Access to unique indices. Fresh index, who dis? πŸ†”

Returns

An integer different from all previous calls.

Okay so this function returns a unique integer every single time it is called. It can be used for any purpose, but it's 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. No drama, no collisions. πŸ•ŠοΈ

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. Periodt. πŸ’…


πŸ‘‘ Member Data Documentation πŸ‘‘

πŸ’Ž template<typename _CharT , typename _Traits > streamsize std::basic_istream< _CharT, _Traits >::_M_gcount [protected], [inherited]

The number of characters extracted in the previous unformatted function; see gcount(). This is the receipts counter, bestie. 🧾

Referenced by std::basic_istream< _CharT, _Traits >::~basic_istream(), std::basic_istream< _CharT, _Traits >::gcount(), 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::basic_istream< char >::get(), std::basic_istream< char >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< char >::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< char >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::readsome(), std::basic_istream< char >::sync(), and std::basic_istream< _CharT, _Traits >::unget().


🎯 const fmtflags std::ios_base::adjustfield [static], [inherited]

A mask of left|right|internal. Useful for the 2-arg form of setf. It's the alignment committee. πŸ“

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. The "always tack it onto the end" queen. πŸ‘‘

Referenced by std::basic_filebuf< _CharT, _Traits >::_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. One and done β€” it's giving "arrive, then go straight to the back of the line." πŸšΆβ€β™€οΈ

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). Yeah. This is the "something went genuinely wrong" flag, not the cute little "oops we hit EOF" flag. 😭

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator>>(), std::basic_istream< _CharT, _Traits >::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< char >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< char >::tellg(), std::basic_istream< _CharT, _Traits >::tellg(), 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. Choose your number era: decimal, octal, or hexadecimal. πŸ”Ÿ

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 square one, literally. 🍼

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

Heads up bestie: this is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. Read the docs, do not assume, we've all been humbled. πŸ™ˆ

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 like true/false instead of 1/0 β€” so much more readable, honestly. πŸŽ€

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. You are here, and you're moving from here. 🧭

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. Ten out of ten, base edition. πŸ’…

Referenced by std::dec().


πŸ”š const seekdir std::ios_base::end [static], [inherited]

Request a seek relative to the current end of the sequence. The grand finale. 🎬

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 it, we've read everything, nothing left to give. 😭

…and to finish off that last constant's cross-reference list (yes, it's a whole guest list, she's popular πŸ’…):

  • std::basic_istream< _CharT, _Traits >::sentry::sentry()
  • std::time_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::num_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_ios< _CharT, _Traits >::eof()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< char >::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, _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< char >::sync()
  • std::basic_istream< _CharT, _Traits >::unget()
  • std::ws()

const iostate std::ios_base::failbit (static, inherited)

Okay so real talk: this one means an input op didn't read the characters it was supposed to read, OR an output op failed to generate the characters you wanted. Basically the "that's not what I ordered" flag ✨

Referenced by:

  • std::basic_istream< _CharT, _Traits >::sentry::sentry()
  • std::basic_ostream< _CharT, _Traits >::sentry::sentry()
  • std::basic_ifstream< _CharT, _Traits >::close()
  • std::basic_ofstream< _CharT, _Traits >::close()
  • std::basic_fstream< _CharT, _Traits >::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_ios< _CharT, _Traits >::fail()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< char >::get()
  • std::time_get< _CharT, _InIter >::get()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_fstream< _CharT, _Traits >::open()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_fstream< _CharT, _Traits >::open()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::operator<<()
  • std::basic_istream< _CharT, _Traits >::operator>>()
  • std::operator>>()
  • std::basic_istream< _CharT, _Traits >::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()
  • std::basic_ostream< _CharT, _Traits >::seekp()

const fmtflags std::ios_base::fixed (static, inherited)

Makes your floating-point output come out in fixed-point notation. No surprise exponents, just vibes πŸŽ€

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


const fmtflags std::ios_base::floatfield (static, inherited)

It's a mask of scientific|fixed β€” genuinely useful for the 2-arg form of setf. iykyk πŸ”₯

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


const iostate std::ios_base::goodbit (static, inherited)

The "everything's fine, we're thriving" flag ✨ all is well, no cap.

Referenced by:

  • std::basic_istream< _CharT, _Traits >::sentry::sentry()
  • std::time_get< _CharT, _InIter >::do_get()
  • 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_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< char >::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_ostream< _CharT, _Traits >::operator<<()
  • std::basic_istream< _CharT, _Traits >::operator>>()
  • std::operator>>()
  • std::basic_istream< _CharT, _Traits >::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< char >::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()
  • std::ws()

const fmtflags std::ios_base::hex (static, inherited)

Integer input gets converted / integer output gets generated in hexadecimal base. Base-16 slay πŸ¦‹

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. It's the default for ifstream and fstream β€” main character energy for reading πŸ‘‘

Referenced by:

  • std::basic_filebuf< _CharT, _Traits >::_M_set_buffer()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()
  • std::basic_filebuf< _CharT, _Traits >::pbackfail()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()
  • std::basic_filebuf< _CharT, _Traits >::showmanyc()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc()
  • std::basic_istream< _CharT, _Traits >::tellg()
  • std::basic_filebuf< _CharT, _Traits >::underflow()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow()
  • std::basic_filebuf< _CharT, _Traits >::xsgetn()

const fmtflags std::ios_base::internal (static, inherited)

Puts the fill characters at a designated internal point in certain generated output. And if no such point is designated? It's literally identical to right. Easy to forget, so don't πŸ™ˆ

Referenced by: std::internal().


const fmtflags std::ios_base::left (static, inherited)

Adds fill characters on the right (the final positions) of certain generated output β€” i.e. the thing you print is flush left. Left-aligned and loving it πŸ’…

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


const fmtflags std::ios_base::oct (static, inherited)

Integer input or integer output in octal base. Base-8 representation for the girlies πŸ“

Referenced by: std::oct().


const openmode std::ios_base::out (static, inherited)

Open for output. Default for ofstream and fstream β€” writing era ✍️

Referenced by:

  • std::basic_filebuf< _CharT, _Traits >::_M_set_buffer()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::basic_filebuf< _CharT, _Traits >::overflow()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()
  • std::basic_ostream< _CharT, _Traits >::tellp()
  • std::basic_filebuf< _CharT, _Traits >::xsputn()

const fmtflags std::ios_base::right (static, inherited)

Adds fill characters on the left (the initial positions) of certain generated output β€” i.e. the thing you print is flush right. Mirror image, equally iconic πŸ’–

Referenced by: std::right().


const fmtflags std::ios_base::scientific (static, inherited)

Generates floating-point output in scientific notation. Big numbers, tiny numbers, all of them get the e treatment πŸ”¬βœ¨

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. So your hex looks like hex, bestie πŸŽ€

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. Yes, even when you think it's unnecessary. Periodt. πŸ’…

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. The "ignore the haters (and the spaces)" flag 🧚

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


const openmode std::ios_base::trunc (static, inherited)

Truncate an existing stream when opening. Default for ofstream β€” so yeah, be careful, she will clear that file out 😭


const fmtflags std::ios_base::unitbuf (static, inherited)

Flushes output after each output operation. Needy? Maybe. Reliable? Absolutely 🫢

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. Glow-up for your hex digits, honestly πŸ” 

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. Not a human, not a vibe curator, just Doxygen doing Doxygen things πŸ€–πŸ’œ


okay bestie, that's the whole page!! πŸ¦‹ You made it to the end β€” go read some files, treat yourself. This masterpiece was auto-generated by Doxygen for libstdc++ straight from the source code, and the footer of the page carries the source/version tag and the date (that lonely little libststd::basic_ifst...harT, _Traits >(3cxx) line at the bottom, truncation and all β€” it's giving "she ran out of characters" πŸ’€). Anyway, ily, go slay your streams ✨🌸

πŸ“¦ where this page comes from