STD::WIFSTREAM(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_typetypedef basic_filebuf< char_type, traits_type > __filebuf_typetypedef basic_ios< _CharT, _Traits > __ios_typetypedef basic_istream< char_type, traits_type > __istream_typetypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typetypedef basic_streambuf< _CharT, _Traits > __streambuf_typetypedef _CharT char_typeenum 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_typetypedef _Ios_Iostate iostateβ this is a bitmask type.typedef traits_type::off_type off_typetypedef _Ios_Openmode openmodeβ this is a bitmask type.typedef traits_type::pos_type pos_typetypedef _Ios_Seekdir seekdirβ this is an enumerated type.typedef _Traits traits_typetypedef 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 &)=deletebasic_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__rhsinto 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 insrc/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 () constlong & 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__fnwith 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 ofleft|right|internal. Useful for the 2-arg form ofsetf.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 ofdec|oct|hex. Useful for the 2-arg form ofsetf.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; seehttps://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.static const fmtflags boolalphaβ insert/extractboolin 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 ofscientific|fixed. Useful for the 2-arg form ofsetf.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 forifstreamandfstream.static const fmtflags internalβ adds fill characters at a designated internal point in certain generated output, or identical torightif 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 forofstreamandfstream.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 forofstream.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_callbacksconst __ctype_type * _M_ctypeiostate _M_exceptionchar_type _M_fillbool _M_fill_initfmtflags _M_flagsstreamsize _M_gcountlocale _M_ios_locale_Words _M_local_word [_S_local_word_size]const __num_get_type * _M_num_getconst __num_put_type * _M_num_putstreamsize _M_precisionbasic_streambuf< _CharT, _Traits > * _M_streambufiostate _M_streambuf_statebasic_ostream< _CharT, _Traits > * _M_tiestreamsize _M_width_Words * _M_wordint _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 tochar_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 theeventenum.__bβ reference to theios_baseobject.__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:
boolalphadecfixedhexinternalleftoctrightscientificshowbaseshowpointshowposskipwsunitbufuppercaseadjustfieldbasefieldfloatfield
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:
badbiteofbitfailbitgoodbit
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:
appatebinaryinouttrunc
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:
begcur, equivalent toSEEK_CURin the C standard library.end, equivalent toSEEK_ENDin 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 (seestd::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::stringspecifying the filename.__modeβ open file in specified mode (seestd::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::pathspecifying the filename.__modeβ open file in specified mode (seestd::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__rhsinto 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 onsigned charandunsigned char. So don't @ me when yoursigned chardoesn'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 ins.
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-1characters 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 onsigned charandunsigned 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.
- the input sequence reaches end-of-file, in which case
eofbitis set in the stream error state - the next character equals
__delim, in which case the character is extracted (and therefore counted ingcount()) but not stored __n-1characters are stored, in which casefailbitis 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(),__ncharacters 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__delimequalstraits::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 afilesystem::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 clearseofbit. And because no characters actually get extracted, the next call togcount()will return0, 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:
__ncharacters 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 onsigned charandunsigned 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, setseofbitand extracts no characters - if
A == 0, extracts no characters - if
A > 0, extractsmin(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 clearseofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call togcount().
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 clearseofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call togcount().
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 forfmtfl.
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 togcount(). And at variance withputback,ungetandseekg,eofbitis 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 clearseofbit. And since no characters are extracted, the next call togcount()will return0, 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
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms