STD::IFSTREAM(3)
๐ std::basic_ifstream< _CharT, _Traits > ๐
okay bestie, welcome to the manual page for std::basic_ifstream< _CharT, _Traits > from the Library Functions Manual, section 3. it's literally all about controlling input for files, and we're about to go through EVERY. SINGLE. DETAIL. no cap. ๐ซถ
โจ NAME โจ
std::basic_ifstream< _CharT, _Traits > โ Controlling input for files.
๐ธ SYNOPSIS ๐ธ
#include <fstream>
Inherits std::basic_istream< _CharT, _Traits >.
๐ Public Types ๐
okay so first up, the types. these are the building blocks, bestie. ๐
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 now the main character energy: all the member functions. we're gonna list every single one. slay. ๐
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.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< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)โ Explicit specialization declarations, defined in src/istream.cc.locale getloc () constโ Locale access.bool good () constโ Fast error checking.basic_istream< wchar_t > & ignore (streamsize __n)basic_istream< char > & ignore (streamsize __n)basic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)basic_istream< char > & ignore (streamsize __n, int_type __delim)locale imbue (const locale &__loc)โ Moves to a new locale.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 __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.
and then these three manipulator interfaces, bestie:
__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 formatted input functions) have 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. ๐
if the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument. periodt.
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. no cap. ๐ซถ
and here are all the arithmetic extractors:
__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.
and the floating point ones:
__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 have some common behavior too. each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. this has several effects, concluding with the setting of a status flag; see the sentry documentation for more. ๐
if the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument. lowkey same as before.
the number of characters extracted is stored for later retrieval by gcount(). iconic.
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. fr fr.
int_type get ()โ simple extraction, one character at a time bestie โจ__istream_type & get (char_type &__c)โ also simple extraction, just dropping it into a ref this time__istream_type & get (char_type *__s, streamsize __n, char_type __delim)โ simple multiple-character extraction, delim included ๐__istream_type & get (char_type *__s, streamsize __n)โ same thing, no delim, she's low maintenance__istream_type & get (__streambuf_type &__sb, char_type __delim)โ extraction into another streambuf, iconic__istream_type & get (__streambuf_type &__sb)โ yeah, extraction into another streambuf again ๐__istream_type & getline (char_type *__s, streamsize __n, char_type __delim)โ string extraction, the classic ๐ธ__istream_type & getline (char_type *__s, streamsize __n)โ string extraction, no delim specified__istream_type & ignore (streamsize __n, int_type __delim)โ discarding characters, she's ignoring them fr fr ๐__istream_type & ignore (streamsize __n)โ simple extraction__istream_type & ignore ()โ simple extraction__istream_type & ignore (streamsize __n, char __delim)โ simple extractionint_type peek ()โ looking ahead in the stream ๐ no touching, just vibes__istream_type & read (char_type *__s, streamsize __n)โ extraction without delimiters, no rulesstreamsize readsome (char_type *__s, streamsize __n)โ extraction until the buffer is exhausted, but no more. she knows her limits โ__istream_type & putback (char_type __c)โ unextracting a single character, putting it back where it came from ๐ซถ__istream_type & unget ()โ unextracting the previous characterint 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 (the other flavor)operator bool () constโ the quick-and-easy status check โbool operator! () constโ the quick-and-easy status check, but make it negative
๐ 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 __noreplacestatic 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. โจ the good endingstatic 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 }
๐ฆ PROTECTED MEMBER FUNCTIONS ๐ฆ
void _M_cache_locale (const locale &__loc)void _M_call_callbacks (event __ev) throw ()void _M_dispose_callbacks (void) throw ()template<typename _ValueT> __istream_type & _M_extract (_ValueT &__v)_Words & _M_grow_words (int __index, bool __iword)void _M_init () throw ()void _M_move (ios_base &) noexceptvoid _M_swap (ios_base &__rhs) noexceptvoid init (basic_streambuf< _CharT, _Traits > *__sb)โ all setup is performed here. ๐ ๏ธvoid move (basic_ios &&__rhs)void move (basic_ios &__rhs)void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)void swap (basic_ios &__rhs) noexceptvoid swap (basic_istream &__rhs)
๐ 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
template<typename _CharT, typename _Traits>
typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
std::basic_ios< _CharT, _Traits >::__num_put_type [inherited]
These are non-standard types. ๐ซถ
event_callback
typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]
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
typedef _Ios_Fmtflags std::ios_base::fmtflags [inherited]
This is a bitmask type. _Ios_Fmtflags is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type fmtflags are:
boolalphadecfixedhexinternalleftoctrightscientificshowbaseshowpointshowposskipwsunitbufuppercaseadjustfieldbasefieldfloatfield
iostate
typedef _Ios_Iostate std::ios_base::iostate [inherited]
This is a bitmask type. _Ios_Iostate is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type iostate are:
badbiteofbitfailbitgoodbit
openmode
typedef _Ios_Openmode std::ios_base::openmode [inherited]
This is a bitmask type. _Ios_Openmode is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type openmode are:
appatebinaryinouttrunc
seekdir
typedef _Ios_Seekdir std::ios_base::seekdir [inherited]
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 ๐ซ
event
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 ๐
template<typename _CharT, typename _Traits> std::basic_ifstream< _CharT, _Traits >::basic_ifstream ()[inline]โ the default constructor, the no-arg icon. โจ
So what it does: it initializes sb using its default constructor, and passes &sb to the base class initializer. And it does not open any files โ because bestie, you haven't given it a filename to open. ๐
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).
Heads up: ios_base::in is automatically included in __mode. No cap. ๐
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).
And again: ios_base::in is automatically included in __mode.
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).
Yep, you guessed it: ios_base::in is automatically included in __mode.
template<typename _CharT, typename _Traits> std::basic_ifstream< _CharT, _Traits >::~basic_ifstream ()[inline]โ the destructor. And bestie, it literally does nothing. ๐ญ
The file is closed by the filebuf object, not the formatting stream. That's the whole vibe โ the cleanup is someone else's job.
๐ Member Function Documentation ๐
const locale & std::ios_base::_M_getloc () const[inline],[inherited]โ Locale access. ๐
Returns
- A reference to the current locale.
It's like getloc above, but it returns a reference instead of generating a copy. Efficient queen behavior.
Referenced by std::money_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::bad () const[inline],[nodiscard],[inherited]โ Fast error checking. โก
Returns
- True if the
badbitis set.
Note that other iostate flags may also be set. Don't assume it's just the one, okay?
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]setsthe error state. ๐
Parameters
__stateโ The new state flag(s) to set.
See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument โ the default is doing the heavy lifting for you.
References std::ios_base::badbit, exceptions(), rdbuf(), and rdstate().
Referenced by std::basic_ios< char_type, traits_type >::exceptions(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::__detail::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), rdbuf(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
template<typename _CharT, typename _Traits> void std::basic_ifstream< _CharT, _Traits >::close ()[inline]โ Close the file. ๐
It calls std::basic_filebuf::close(). And if that function fails, failbit is set in the stream's error state. So like, it tells you when things go wrong. Respect.
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. ๐ง
Parameters
__rhsโ The source values for the copies.
Returns
- Reference to this object.
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().
References basic_ios(), std::__addressof(), exceptions(), fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), tie(), std::tie(), and std::ios_base::width().
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::eof () const[inline],[nodiscard],[inherited]โ Fast error checking. โก
Returns
- True if the
eofbitis set.
Note that other iostate flags may also be set.
template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::exceptions () const[inline],[nodiscard],[inherited]โ Throwing exceptions on errors. ๐ซถ
Returns
- The current exceptions mask.
This changes nothing in the stream. See the one-argument version of exceptions(iostate) for the meaning of the return value.
Referenced by clear(), and 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. 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.
And here's the spicy part: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. 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);
}
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::fail () const[inline],[nodiscard],[inherited]โ Fast error checking. โก
Returns
- True if either the
badbitor thefailbitis set.
Checking the badbit in fail() is historical practice, iykyk. Note that other iostate flags may also be set.
Referenced by std::basic_ios< char_type, traits_type >::operator bool(), std::basic_ios< char_type, traits_type >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::fill () const[inline],[nodiscard],[inherited]โ Retrieves the empty character. ๐ธ
Returns
- The current fill character.
It defaults to a space (' ') in the current locale.
Referenced by copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
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.
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.
fmtflags std::ios_base::flags () const[inline],[nodiscard],[inherited]โ Access to format flags. ๐
Returns
- The format control flags for both input and output.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
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. Total takeover.
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.
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().
It tries to extract a character. If none are available, it sets failbit and returns traits::eof().
References _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::basic_istream< char_type, traits_type >::get(), and std::basic_istream< char_type, traits_type >::get().
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')).
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. ๐
Parameters
__sbโ a streambuf in which to store data ๐พ__delimโ a "stop" character ๐
Returns
*this
So basically bestie, characters get extracted and inserted into __sb until one of these things happens, and you gotta know all of them:
- the input sequence reaches
EOF๐ - insertion into the output buffer fails (and in this case, the character that would have been inserted is not extracted โ it stays put, no cap)
- the next character equals
__delim(in this case, the character is not extracted either, she stays right where she is ๐ ) - an exception occurs (and in this case is caught ๐ซถ)
If no characters are stored, failbit is set in the stream's error state. Rude, but that's the rules.
References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type & __c) [inherited]
Simple extraction. Okay so this one is giving "just grab me one lil guy" energy โจ
Parameters
__cโ the character in which to store data
Returns
*this
She tries to extract a character and store it in __c. If none are available, she sets failbit and returns traits::eof() ๐ญ
Note: this function is not overloaded onsigned charandunsigned char. Just so you know, iykyk.
References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::get (char_type * __s, streamsize __n) [inline], [inherited]
Simple multiple-character extraction ๐
Parameters
__sโ pointer to an array__nโ maximum number of characters to store ins
Returns
*this
Literally just returns get(__s,__n,widen('\n')). That's it, that's the whole function, periodt ๐
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, 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
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.
In any case, a null character is stored into the next location in the array. Iconic behaviour honestly ๐
Note: this function is not overloaded onsigned charandunsigned char.
References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::getline (char_type * __s, streamsize __n) [inline], [inherited]
String extraction ๐
Parameters
__sโ a character array in which to store the data__nโ maximum number of characters to extract
Returns
*this
And she simply returns getline(__s,__n,widen('\n')). Short queen, we stan ๐ฆ
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 the whole vibe โ she's declared here, built over there ๐
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, the main character version โจ
Parameters
__sโ a character array in which to store the data__nโ maximum number of characters to extract__delimโ a "stop" character
Returns
*this
She extracts and stores characters into __s until one of the following happens. And okay this is the important bit bestie โ these criteria are required to be tested in the order listed here, specifically so that 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. Good to know fr fr ๐)
In any case, a null character is stored in the next location in the array.
Referenced by std::basic_istream< char_type, traits_type >::getline().
locale std::ios_base::getloc () const [inline], [nodiscard], [inherited]
Locale access ๐
Returns: a copy of the current locale.
If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. So she's either the custom one you set, or the default โ no in-between ๐
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::basic_ios< _CharT, _Traits >::imbue(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::good () const [inline], [nodiscard], [inherited]
Fast error checking, the speedrun version โก
Returns: true if no error flags are set.
She's just a wrapper around rdstate. Lowkey does one thing and does it well ๐ซถ
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (void ) [inherited]
Simple extraction ๐
Returns: a character, or eof().
She tries to extract a character. If none are available, she sets failbit and returns traits::eof() ๐ญ
References: _M_gcount, std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sbumpc().
Referenced by std::basic_istream< char_type, traits_type >::ignore().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n) [inherited]
Simple extraction again ๐
Returns: a character, or eof().
She tries to extract a character. If none are available, she sets failbit and returns traits::eof().
References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, char __delim) [inline], [inherited]
Simple extraction, she's inline this time โจ
Returns: a character, or eof().
She tries to extract a character. If none are available, she sets failbit and returns traits::eof().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, int_type __delim) [inherited]
Discarding characters โ the "I don't want this, throw it away" function ๐๏ธ
Parameters
__nโ number of characters to discard__delimโ a "stop" character
Returns
*this
She 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); and note that this condition will never occur if__delimequalstraits::eof()๐
NB: provide four overloads, instead of the single function (with defaults) mandated by the Standard: this leads to a better performing implementation, while still conforming to the Standard. So yeah, four of them, on purpose, for the speed ๐
References: _M_gcount, and std::ios_base::goodbit.
template<typename _CharT, typename _Traits> locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]
Moves to a new locale ๐โจ
Parameters
__locโ the new locale
Returns: the previous locale.
She calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, she calls that buffer's pubimbue(loc). Two-for-one, obsessed ๐ซถ
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
References: std::ios_base::getloc(), std::ios_base::imbue(), and rdbuf().
Referenced by std::chrono::operator<<().
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]
All setup is performed here. She's called from the public constructor. She is not virtual and cannot be redefined. Protected queen, no touching ๐๐
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().
(That's a lot of constructors calling her. She's booked and busy ๐ )
template<typename _CharT, typename _Traits> bool std::basic_ifstream< _CharT, _Traits >::is_open () [inline], [nodiscard]
Wrapper to test for an open file ๐
Returns: rdbuf()->is_open()
That's it. One line, one job, she ate ๐
long & std::ios_base::iword (int __ix) [inline], [inherited]
Access to integer array ๐ข
Parameters
__ixโ index into the array
Returns: a reference to an integer associated with the index.
The iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0.
The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference โ she'll move out from under you, literally ๐ญ
References: iword().
Referenced by iword(). (Yes, she references herself. Main character energy fr fr ๐)
narrow ๐
(the character squeezer)
template<typename _CharT, typename _Traits> char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const
[inline], [inherited]
okay so this one squeezes characters ๐ซณโจ It takes a character of char_type and maps it to a character of char, if that's even possible.
Parameters
__cโ the character to narrow.__dfaultโ the character to narrow.
Returns
- the narrowed character.
Concretely, bestie, it hands you back the result of
std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
and if you want the extra lore, the additional l10n notes live at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html ๐
open (the filesystem::path one) ๐
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. yes we're opening a whole file, main character behavior fr fr ๐
Parameters
__sโ the name of the file, as afilesystem::path.__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 ๐ญ no cap.
open (the const char * one) ๐ค
template<typename _CharT, typename _Traits> void std::basic_ifstream< _CharT, _Traits >::open (const char * __s, ios_base::openmode __mode = ios_base::in)
[inline]
Opens an external file. same energy, different argument type ๐
Parameters
__sโ the name of the file.__modeโ the open mode flags.
It calls std::basic_filebuf::open(s,__mode|in). If that function fails, failbit is set in the stream's error state.
Referenced bystd::basic_ifstream< char >::basic_ifstream(),std::basic_ifstream< char >::basic_ifstream(), andstd::basic_ifstream< char >::open().
open (the std::string & one) ๐งต
template<typename _CharT, typename _Traits> void std::basic_ifstream< _CharT, _Traits >::open (const std::string & __s, ios_base::openmode __mode = ios_base::in)
[inline]
Opens an external file. third flavor, still iconic ๐ธ
Parameters
__sโ the name of the file.__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.
operator bool โ the vibe check โ
template<typename _CharT, typename _Traits> std::basic_ios< _CharT, _Traits >::operator bool () const
[inline], [explicit], [nodiscard], [inherited]
The quick-and-easy status check ๐ It literally lets you write constructs such as if (!a_stream) ... and while (a_stream) ... and that's the whole point, periodt.
operator! โ the same vibe check, but negated ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::operator! () const
[inline], [nodiscard], [inherited]
Also the quick-and-easy status check ๐ซถ It allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... โ yes, exactly like the one above, they're besties.
operator>> โ the manipulator interfaces ๐๏ธ
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__ios_type &(* __pf )(__ios_type &))
[inline], [inherited]
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__istream_type &(* __pf )(__istream_type &))
[inline], [inherited]
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (ios_base &(* __pf )(ios_base &))
[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. iykyk ๐
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. ๐ซ
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__sbisNULL, the stream will setfailbitin its error state. ๐จ
Characters are extracted from this stream and inserted into the __sb streambuf until one of the following occurs:
- the input stream reaches end-of-file,
- insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted), or
- an exception occurs (and in this case is caught).
If the function inserts no characters, failbit is set. ๐
References std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Integer & float extractors โ the whole squad ๐ข
Every single one of these bad boys does the same iconic thing, so here's the family photo ๐ธ
operator>> โ bool & __n
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (bool & __n)
[inline], [inherited]
Integer arithmetic extractors. ๐งฎ
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ double & __f
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ float & __f
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ int & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ long & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ long double & __f
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ long long & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ short & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
References std::ios_base::badbit, std::ios_base::failbit, std::num_get< _CharT, _InIter >::get(), std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet().
operator>> โ unsigned int & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ unsigned long & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ unsigned long long & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ unsigned short & __n
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ void *& __p
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (void *& __p)
[inline], [inherited]
Basic arithmetic extractors. โจ (yes, pointer edition, we love range ๐ซถ)
Parameters
__pโ a variable of pointer type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
peek โ the sneaky lil lookahead ๐
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::peek (void )
[inherited]
Looking ahead in the stream. no touching, just looking ๐
Returns
- the next character, or
eof().
If, after constructing the sentry object, good() is false, it returns traits::eof(). Otherwise it reads but does not extract the next input character โ so it stays right where it is, lowkey iconic ๐
References _M_gcount, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdbuf().
precision โ flags access ๐๏ธ
streamsize std::ios_base::precision () const
[inline], [nodiscard], [inherited]
Flags access. ๐
Returns
- the precision to generate on certain output operations.
โ ๏ธ bestie, be careful if you try to give a definition of precision right here โ see DR 189. that's the vibes.
Referenced by:
std::basic_ios< _CharT, _Traits >::copyfmt()std::chrono::operator<<()
๐๏ธ streamsize std::ios_base::precision (streamsize __prec) [inline], [inherited]
Changing flags. yes we're changing the flags, it's giving glow-up โจ
Parameters
__precโ the new precision value.
Returns
- The previous value of
precision().
๐ซฐ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::putback (char_type __c) [inherited]
Unextracting a single character. putting it back. the character said sike ๐
Parameters
__cโ the character to push back into the input stream.
Returns
*this
If rdbuf() is not null, calls rdbuf()->sputbackc(c).
If rdbuf() is null or if sputbackc() fails, sets badbit in the error state.
๐ Note: this function first clearseofbit. Since no characters are extracted, the next call togcount()will return0, as required by DR 60. (zero. nothing. nada. it's giving empty-handed ๐ซ )
References _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_streambuf< _CharT, _Traits >::sputbackc().
Referenced by std::operator<<().
๐ void *& std::ios_base::pword (int __ix) [inline], [inherited]
Access to void pointer array. iconic little pointer stash ๐
Parameters
__ixโ index into the array.
Returns
- A reference to a
void*associated with the index.
The pword function provides access to an array of pointers that can be used for any purpose. The array grows as required to hold the supplied index. All pointers in the array are initialized to 0.
๐จ The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. fr fr, do not clutch it.
๐ฆ template<typename _CharT, typename _Traits> __filebuf_type * std::basic_ifstream< _CharT, _Traits >::rdbuf () const [inline], [nodiscard]
Accessing the underlying buffer. main character accessing the backstage ๐ญ
Returns
- The current
basic_filebufbuffer.
This hides both signatures of std::basic_ios::rdbuf().
๐ 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. swap the whole vibe out.
Parameters
__sbโ the new stream buffer.
Returns
- The previous stream buffer.
Associates a new buffer with the current stream, and clears the error state.
๐ okay so due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. like:
std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>
References clear().
๐ template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [nodiscard], [inherited]
Returns the error state of the stream buffer. the vibe check, essentially โจ
Returns
- A bit pattern (well, isn't everything?)
See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().
Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
๐ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::read (char_type * __s, streamsize __n) [inherited]
Extraction without delimiters. no stopping for commas, we go straight through ๐โโ๏ธ
Parameters
__sโ a character array.__nโ maximum number of characters to store.
Returns
*this
If the stream state is good(), extracts characters and stores them into __s until one of the following happens:
__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.
References _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
๐ 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 takes what's there and does NOT go asking for extra ๐ซถ
Parameters
__sโ a character array.__nโ maximum number of characters to store.
Returns
- The number of characters extracted.
Extracts characters and stores them into __s depending on the number of characters remaining in the streambuf's buffer, rdbuf()->in_avail(), called A here:
- if
A == -1, setseofbitand extracts no characters - if
A == 0, extracts no characters - if
A > 0, extractsmin(A,n)
The goal is to empty the current buffer, and to not request any more from the external input sequence controlled by the streambuf.
References _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. it's giving โจsubscribe to my eventsโจ
Parameters
__fnโ the function to add.__indexโ the integer to pass to the function when invoked.
Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered. first come, first served, no cutting the line ๐
โฉ 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. gliding to a new spot ๐ง
Parameters
__offโ a file offset object.__dirโ the direction in which to seek.
Returns
*this
If fail() is not true, calls rdbuf()->pubseekoff(__off,__dir). If that function fails, sets failbit.
๐ Note: this function first 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. same energy, different parameter ๐
Parameters
__posโ a file position object.
Returns
*this
If fail() is not true, calls rdbuf()->pubseekpos(__pos). If that function fails, 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. new fit, who dis ๐
Parameters
__fmtflโ additional flags to set.
Returns
- The previous format control flags.
This function sets additional flags in format control. Flags that were previously set remain set. nothing gets un-set, we only add ๐ซถ
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 function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield.
๐ฉ template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::setstate (iostate __state) [inline], [inherited]
Sets additional flags in the error state. flagging the drama ๐ฉ
Parameters
__stateโ the additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), and std::ws().
๐ template<typename _CharT, typename _Traits> int std::basic_istream< _CharT, _Traits >::sync (void ) [inherited]
Synchronizing the stream buffer. getting everything on the same page, as one does ๐
Returns
0on success,-1on failure
So if rdbuf() is giving null pointer energy, it just returns -1. Bye. ๐
Otherwise it calls rdbuf()->pubsync(), and if that comes back -1, it sets badbit and returns -1.
And otherwise? Returns 0. That's it, that's the whole vibe. โจ
Note โ bestie this function does not count the number of characters extracted, if any, so it does not affect the next call to gcount(). No cap.
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().
๐ bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]
Interaction with the standard C I/O objects. Like, the two of them finally talking to each other. ๐ค
Parameters
__syncโ Whether to synchronize or not.
Returns
True if the standard streams were previously synchronized.
The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected, they're doing their own thing, main character energy. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary
๐ฆ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >::pos_type std::basic_istream< _CharT, _Traits >::tellg (void ) [inherited]
Getting the current read position. Where are we, bestie? ๐
Returns
A file position object.
If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,in).
Note โ this function does not count the number of characters extracted, if any, and therefore does not affect the next call togcount(). At variance withputback,ungetandseekg,eofbitis not cleared first. She's different like that. ๐
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], [nodiscard], [inherited]
Fetches the current tied stream. Girl, who are you tied to? ๐ซถ
Returns
A pointer to the tied stream, or NULL if the stream is not tied.
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 behaviour honestly.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and 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. Setting up the situationship. ๐
Parameters
__tiestrโ The output stream.
Returns
The previously tied output stream, or NULL if the stream was not tied.
This sets up a new tie; see tie() for more. iykyk.
๐ธ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::unget (void ) [inherited]
Unextracting the previous character. Putting it back. Not me rewinding the tape ๐ญ
Returns
*this
If rdbuf() is not null, calls rdbuf()->sungetc(c).
If rdbuf() is null or if sungetc() fails, sets badbit in the error state.
Note โ this function first clearseofbit. Since no characters are extracted, the next call togcount()will return0, as required by DR 60. Periodt.
References _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), and std::basic_streambuf< _CharT, _Traits >::sungetc().
Referenced by std::__detail::operator>>().
โจ void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited]
Clearing format flags. Decluttering, we love to see it. ๐งน
Parameters
__maskโ The flags to unset.
This function clears __mask in the format flags.
๐ง 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.
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 https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
Referenced by std::endl(), std::basic_ios< char_type, traits_type >::fill(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::getline(), std::getline(), std::getline(), std::operator<<(), std::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::tr2::operator>>().
โญ streamsize std::ios_base::width () const [inline], [nodiscard], [inherited]
Flags access.
Returns
The minimum field width to generate on output operations.
Minimum field width refers to the number of characters. Just characters, that's the whole measurement. ๐
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. Glow-up edition.
Parameters
__wideโ The new width value.
Returns
The previous value of width().
๐ int std::ios_base::xalloc () [static], [inherited]
Access to unique indices. Every girl gets her own number, no duplicates allowed. ๐
Returns
An integer different from all previous calls.
This function returns a unique integer every time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict.
The implementation maintains a static variable that is incremented and returned on each invocation. xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays. Fr fr, it's safe.
๐ 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(). She's keeping receipts. ๐งพ
Referenced by get(), get(), get(), get(), ignore(), ignore(), ignore(), peek(), putback(), read(), readsome(), and unget().
๐ const fmtflags std::ios_base::adjustfield [static], [inherited]
A mask of left|right|internal. Useful for the 2-arg form of setf.
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().
๐ธ const openmode std::ios_base::app [static], [inherited]
Seek to end before each write. Every single time. She always arrives last. ๐
Referenced by std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
๐ฆ const openmode std::ios_base::ate [static], [inherited]
Open and seek to end immediately after opening. One and done, no repeating. โจ
Referenced by std::basic_filebuf< _CharT, _Traits >::open().
๐ const iostate std::ios_base::badbit [static], [inherited]
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). This is the bad one bestie, this is the "it's over" bit. ๐ญ
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, char_traits< _CharT > >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
๐ข const fmtflags std::ios_base::basefield [static], [inherited]
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().
๐ const seekdir std::ios_base::beg [static], [inherited]
Request a seek relative to the beginning of the stream. Back to the start, we're rewinding the whole era. โช
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). This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
bestie please read the link, do not assume. This one trips everybody up. ๐
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 true/false instead of 1/0. Cute! ๐ธ
Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().
๐ const seekdir std::ios_base::cur [static], [inherited]
Request a seek relative to the current position within the sequence. Right here, right now. โจ
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. Base ten, the classic. ๐
Referenced by std::dec(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
๐ const seekdir std::ios_base::end [static], [inherited]
Request a seek relative to the current end of the sequence. Straight to the end, no skimming. ๐
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. We ran out, bestie, that's all she wrote. ๐ญ
โฆand the rest of that referenced-by glow-up list, bestie, it just keeps going ๐ญ
std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get_date()std::time_get< _CharT, _InIter >::do_get_monthname()std::time_get< _CharT, _InIter >::do_get_time()std::time_get< _CharT, _InIter >::do_get_weekday()std::time_get< _CharT, _InIter >::do_get_year()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::time_get< _CharT, _InIter >::get()std::basic_istream< _CharT, _Traits >::ignore()std::basic_istream< _CharT, _Traits >::operator>>()std::operator>>()std::basic_istream< _CharT, char_traits< _CharT > >::peek()std::basic_istream< _CharT, _Traits >::putback()std::basic_istream< _CharT, _Traits >::read()std::basic_istream< _CharT, _Traits >::readsome()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, char_traits< _CharT > >::seekg()std::basic_istream< _CharT, _Traits >::unget()std::basic_istream< _CharT, char_traits< _CharT > >::unget()std::ws()
const iostate std::ios_base::failbit[static], [inherited] โ this is the ouch flag ๐ it means an input operation failed to read the characters it was expecting, OR an output operation failed to make the characters you wanted. either way bestie, something did not go as planned.
Referenced by:
std::basic_ostream< _CharT, _Traits >::sentry::sentry()std::basic_fstream< char >::close()std::basic_ifstream< char >::close()std::basic_ofstream< char >::close()std::num_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get_monthname()std::time_get< _CharT, _InIter >::do_get_weekday()std::time_get< _CharT, _InIter >::do_get_year()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::time_get< _CharT, _InIter >::get()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::operator<<()std::basic_iostream< char_type, traits_type >::operator>>()std::basic_istream< _CharT, _Traits >::operator>>()std::basic_istream< _CharT, _Traits >::operator>>()std::operator>>()std::basic_istream< _CharT, _Traits >::read()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_ostream< _CharT, _Traits >::seekp()
const fmtflags std::ios_base::fixed[static], [inherited] โ makes floating-point output come out in fixed-point notation. no exponent drama, just a nice stable decimal point โจ
Referenced by: std::fixed(), and std::hexfloat().
const fmtflags std::ios_base::floatfield[static], [inherited] โ it's a mask ofscientific|fixed. super useful for the 2-arg form ofsetf, iykyk ๐
Referenced by: std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
const iostate std::ios_base::goodbit[static], [inherited] โ everything is fine, we're thriving, no notes, the vibe check is passed ๐ (it literally indicates all is well.)
Referenced by:
std::basic_istream< _CharT, _Traits >::sentry::sentry()std::num_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get_monthname()std::time_get< _CharT, _InIter >::do_get_weekday()std::time_get< _CharT, _InIter >::do_get_year()std::basic_ostream< _CharT, _Traits >::flush()std::basic_iostream< char_type, traits_type >::get()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::time_get< _CharT, _InIter >::get()std::basic_istream< _CharT, _Traits >::ignore()std::basic_istream< _CharT, _Traits >::ignore()std::basic_istream< _CharT, _Traits >::ignore()std::basic_iostream< char_type, traits_type >::operator<<()std::basic_ostream< _CharT, _Traits >::operator<<()std::basic_iostream< char_type, traits_type >::operator>>()std::basic_istream< _CharT, _Traits >::operator>>()std::basic_istream< _CharT, _Traits >::operator>>()std::operator>>()std::basic_istream< _CharT, _Traits >::peek()std::basic_ostream< _CharT, _Traits >::put()std::basic_istream< _CharT, _Traits >::putback()std::basic_istream< _CharT, _Traits >::read()std::basic_istream< _CharT, _Traits >::readsome()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::sync()std::basic_istream< _CharT, _Traits >::unget()std::ws()
const fmtflags std::ios_base::hex[static], [inherited] โ integer input gets converted, or integer output gets generated, in base 16. hexadecimal bestie, we love a little0-9a-fmoment ๐ฅ
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 ๐ซถ and it's the default forifstreamandfstream.
Referenced by:
std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_ifstream< char >::basic_ifstream()std::basic_ifstream< char >::basic_ifstream()std::basic_ifstream< char >::basic_ifstream()std::basic_istringstream< char >::basic_istringstream()std::basic_stringbuf< char >::basic_stringbuf()std::basic_stringstream< char >::basic_stringstream()std::basic_filebuf< char_type, traits_type >::_M_set_buffer()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()std::basic_filebuf< _CharT, _Traits >::pbackfail()std::basic_streambuf< char_type, traits_type >::pubseekoff()std::basic_streambuf< char_type, traits_type >::pubseekpos()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_streambuf< char_type, traits_type >::seekoff()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()std::basic_stringbuf< char >::seekoff()std::basic_streambuf< char_type, traits_type >::seekpos()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()std::basic_stringbuf< char >::seekpos()std::basic_filebuf< _CharT, _Traits >::showmanyc()std::basic_stringbuf< char >::showmanyc()std::basic_istream< _CharT, _Traits >::tellg()std::basic_filebuf< _CharT, _Traits >::underflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow()std::basic_filebuf< _CharT, _Traits >::xsgetn()
const fmtflags std::ios_base::internal[static], [inherited] โ drops the fill characters at a designated internal point in certain generated output โจ and if there's no such designated point? it behaves identical toright. she's flexible like that.
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. aka the thing you print is flush left, periodt ๐
Referenced by: std::num_put< _CharT, _OutIter >::do_put(), std::left(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
const fmtflags std::ios_base::oct[static], [inherited] โ integer input gets converted, or integer output gets generated, in base 8. octal girlies rise ๐ธ
Referenced by: std::oct().
const openmode std::ios_base::out[static], [inherited] โ open for output ๐ซถ and it's the default forofstreamandfstream.
Referenced by:
std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ostringstream< char >::basic_ostringstream()std::basic_stringbuf< char >::basic_stringbuf()std::basic_stringstream< char >::basic_stringstream()std::basic_filebuf< char_type, traits_type >::_M_set_buffer()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::basic_filebuf< _CharT, _Traits >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail()std::basic_streambuf< char_type, traits_type >::pubseekoff()std::basic_streambuf< char_type, traits_type >::pubseekpos()std::basic_streambuf< char_type, traits_type >::seekoff()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()std::basic_stringbuf< char >::seekoff()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_streambuf< char_type, traits_type >::seekpos()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()std::basic_stringbuf< char >::seekpos()std::basic_ostream< _CharT, _Traits >::tellp()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. aka the thing you print is flush right, periodt ๐
Referenced by: std::right().
const fmtflags std::ios_base::scientific[static], [inherited] โ generates floating-point output in scientific notation ๐ฌโจ big numbers, tiny exponent, main character energy.
Referenced by: std::hexfloat(), and std::scientific().
const fmtflags std::ios_base::showbase[static], [inherited] โ generates a prefix that shows off the numeric base of the generated integer output. like a little name tag for your number ๐
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 the generated floating-point output. no matter what. she's showing up regardless ๐
Referenced by: std::noshowpoint(), and std::showpoint().
const fmtflags std::ios_base::showpos[static], [inherited] โ generates a+sign in non-negative generated numeric output. yes, even when it's positive, she wants the credit ๐ซถ
Referenced by: std::noshowpos(), and std::showpos().
const fmtflags std::ios_base::skipws[static], [inherited] โ skips leading white space before certain input operations. quietly clearing the way, doing the most thankless job fr ๐ง
Referenced by: std::noskipws(), std::__detail::operator>>(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, and std::skipws().
const openmode std::ios_base::trunc[static], [inherited] โ truncates an existing stream when opening. ๐ญ she does not preserve anything, she starts fresh. and it's the default forofstream.
lowkey scary bestie, if you open with trunc the old contents are just gone, so know what you're doing ๐
const fmtflags std::ios_base::unitbuf[static], [inherited] โ flushes the output after each output operation. obsessive? maybe. but nothing ever sits unflushed, so.
Referenced by: std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().
const fmtflags std::ios_base::uppercase[static],[inherited]โ bestie, this one is a glow-up switch ๐ฅ it swaps out certain lowercase letters for their uppercase equivalents in whatever output gets generated. that's it, that's the whole vibe: lowercase in, LOUD out.
Referenced bystd::num_put< _CharT, _OutIter >::do_put(),std::nouppercase(), andstd::uppercase().
so yeah, three whole places cite this flag as their source of truth โ the do_put() formatter over in std::num_put< _CharT, _OutIter >, plus the two free functions that toggle it: std::nouppercase() and std::uppercase(). it's giving main character of the format flags, honestly. ๐
๐ Author ๐
Generated automatically by Doxygen for libstdc++ from the source code.
likeโฆ no human sat down and hand-wrote this, it just materialized straight out of the source code via Doxygen for libstdc++. iconic automation moment โจ๐ค
and that's a wrap on the whole page, bestie!! ๐ซถ you made it all the way to the end, which is lowkey a flex. this lil masterpiece lives in libstdc++ and its man page is titled std::basic... _Traits >(3) โ go forth and stream responsibly, no cap. ๐๐ธ๐ฆ bye pookie!! ๐
๐ฆ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms