STD::BASIC_FSTREAM(3)
โจ NAME โจ
okay so bestie, this is the Library Functions Manual, section 3, and today's main character is std::basic_fstream< _CharT, _Traits > โ she's literally Controlling input and output for files. ๐ file I/O? She ate. Periodt.
๐ฆ SYNOPSIS ๐ฆ
#include <fstream>
She inherits std::basic_iostream< _CharT, _Traits >. Lowkey iconic.
๐ Public Types ๐
typedef ctype< _CharT > __ctype_typeโ yes, she's listed twice in the source, and we're keeping both because every detail matters, no cap. ๐typedef ctype< _CharT > __ctype_typetypedef basic_filebuf< char_type, traits_type > __filebuf_typetypedef basic_ios< char_type, traits_type > __ios_typetypedef basic_iostream< char_type, traits_type > __iostream_typetypedef basic_istream< _CharT, _Traits > __istream_typetypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typetypedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typetypedef basic_ostream< _CharT, _Traits > __ostream_typetypedef basic_streambuf< _CharT, _Traits > __streambuf_typeโ and yeah, she's duplicated too. we respect the duplication. ๐ซถtypedef 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_type
๐ Public Member Functions ๐
basic_fstream ()โ Default constructor.basic_fstream (basic_fstream &&__rhs)โ no description, but she's iconic. โจtemplate<typename _Path, typename _Require = _If_fs_path<_Path>> basic_fstream (const _Path &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)โ Create an input/output file stream.basic_fstream (const basic_fstream &)=deleteโ deleted, no copying bestie. ๐basic_fstream (const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)โ Create an input/output file stream.basic_fstream (const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)โ Create an input/output file stream.~basic_fstream ()โ The destructor does nothing.template<typename _ValueT> basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)const locale & _M_getloc () constโ Locale access.template<typename _ValueT> basic_ostream< _CharT, _Traits > & _M_insert (_ValueT __v)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.__ostream_type & flush ()โ Synchronizing the stream buffer.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|ios_base::out)โ Opens an external file.void open (const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)โ Opens an external file.void open (const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)โ Opens an external file.__ostream_type & operator<< (__streambuf_type *__sb)โ Extracting from another streambuf.__ostream_type & operator<< (const void *__p)โ Pointer arithmetic inserters.__ostream_type & operator<< (const volatile void *__p)__ostream_type & operator<< (nullptr_t)basic_fstream & operator= (basic_fstream &&__rhs)basic_fstream & operator= (const basic_fstream &)=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.__ostream_type & seekp (off_type, ios_base::seekdir)โ Changing the current write position.__ostream_type & seekp (pos_type)โ Changing the current write position.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_fstream &__rhs)pos_type tellp ()โ Getting the current write position.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.__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 ๐ฅ
All the operator>> functions (aka formatted input functions) have some common behavior. Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to 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.
โ ๏ธ If an exception is thrown during extraction,ios_base::badbitwill be turned on in the stream's error state (without causing anios_base::failureto be thrown) and the original exception will be rethrown ifbadbitis set in the exceptions mask.
__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 have some common behavior. Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.
If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.
The number of characters extracted is stored for later retrieval by gcount().
โ ๏ธ If an exception is thrown during extraction,ios_base::badbitwill be turned on in the stream's error state (without causing anios_base::failureto be thrown) and the original exception will be rethrown ifbadbitis set in the exceptions mask.
int_type get ()โ simple extraction, just a lil grab, ngl ๐__istream_type & get (char_type &__c)โ simple extraction, same energy โจ__istream_type & get (char_type *__s, streamsize __n, char_type __delim)โ simple multiple-character extraction, periodt ๐ธ__istream_type & get (char_type *__s, streamsize __n)โ simple multiple-character extraction, no biggie ๐__istream_type & get (__streambuf_type &__sb, char_type __delim)โ extraction into another streambuf, slay ๐ฆ__istream_type & get (__streambuf_type &__sb)โ extraction into another streambuf, iconic ๐__istream_type & getline (char_type *__s, streamsize __n, char_type __delim)โ string extraction, bestie ๐__istream_type & getline (char_type *__s, streamsize __n)โ string extraction, fr fr ๐__istream_type & ignore (streamsize __n, int_type __delim)โ discarding characters, bye ๐__istream_type & ignore (streamsize __n)โ simple extraction, iykyk ๐__istream_type & ignore ()โ simple extraction, same ๐__istream_type & ignore (streamsize __n, char __delim)โ simple extraction, periodt โจint_type peek ()โ looking ahead in the stream, no cap ๐__istream_type & read (char_type *__s, streamsize __n)โ extraction without delimiters, that's the vibe ๐ฅstreamsize readsome (char_type *__s, streamsize __n)โ extraction until the buffer is exhausted, but no more โ literally the whole point ๐ฏ__istream_type & putback (char_type __c)โ unextracting a single character, put it back bestie ๐__istream_type & unget ()โ unextracting the previous character, rewind โจint sync ()โ synchronizing the stream buffer, keeping it in sync ๐pos_type tellg ()โ getting the current read position, where u at? ๐__istream_type & seekg (pos_type)โ changing the current read position, moving different ๐__istream_type & seekg (off_type, ios_base::seekdir)โ changing the current read position, same energy ๐ซ
operator bool () constโ the quick-and-easy status check, periodt ๐bool operator! () constโ the quick-and-easy status check, same vibe โจ
__ostream_type & operator<< (__ostream_type &(*__pf)(__ostream_type &))โ interface for manipulators, iconic ๐__ostream_type & operator<< (__ios_type &(*__pf)(__ios_type &))โ interface for manipulators, slay ๐__ostream_type & operator<< (ios_base &(*__pf)(ios_base &))โ interface for manipulators, periodt ๐ธ
โจ Inserters โจ
Okay bestie, all the operator<< functions (aka formatted output functions) have some common behavior, no cap. Each one starts by constructing a temporary object of type std::basic_ostream::sentry. This can have 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 generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state without causing an ios_base::failure to be thrown. The original exception will then be rethrown. That's the tea โ
__ostream_type & operator<< (long __n)โ integer arithmetic inserters, fr fr__ostream_type & operator<< (unsigned long __n)โ integer arithmetic inserters, same__ostream_type & operator<< (bool __n)โ integer arithmetic inserters, periodt__ostream_type & operator<< (short __n)โ integer arithmetic inserters, slay__ostream_type & operator<< (unsigned short __n)โ integer arithmetic inserters, iconic__ostream_type & operator<< (int __n)โ integer arithmetic inserters, no cap__ostream_type & operator<< (unsigned int __n)โ integer arithmetic inserters, bestie__ostream_type & operator<< (long long __n)โ integer arithmetic inserters, ๐__ostream_type & operator<< (unsigned long long __n)โ integer arithmetic inserters, โจ__ostream_type & operator<< (double __f)โ floating point arithmetic inserters, ๐ธ__ostream_type & operator<< (float __f)โ floating point arithmetic inserters, ๐__ostream_type & operator<< (long double __f)โ floating point arithmetic inserters, ๐ฆ
โจ Unformatted Output Functions โจ
All the unformatted output functions have some common behavior, bestie. Each starts by constructing a temporary object of type std::basic_ostream::sentry. 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 generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state. If badbit is on in the stream's exceptions mask, the exception will be rethrown without completing its actions. No cap.
__ostream_type & put (char_type __c)โ simple insertion, just a lil put ๐__ostream_type & write (const char_type *__s, streamsize __n)โ character string insertion, slay โจ
โจ Static Public Member Functions โจ
static bool sync_with_stdio (bool __sync=true)โ interaction with the standard C I/O objects, periodt ๐static int xalloc () throw ()โ access to unique indices, iconic ๐
โจ Static Public Attributes โจ
static const openmode __noreplacestatic const fmtflags adjustfieldโ a mask ofleft|right|internal. Useful for the 2-arg form ofsetf, iykyk.static const openmode appโ seek to end before each write, bestie.static const openmode ateโ open and seek to end immediately after opening, slay.static const iostate badbitโ indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). That's the drama ๐static const fmtflags basefieldโ a mask ofdec|oct|hex. Useful for the 2-arg form ofsetf, fr fr.static const seekdir begโ request a seek relative to the beginning of the stream, no cap.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, periodt.static const seekdir curโ request a seek relative to the current position within the sequence, where u at? ๐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, the end bestie โจstatic const iostate eofbitโ indicates that an input operation reached the end of an input sequence, bye ๐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. Oof ๐ญstatic const fmtflags fixedโ generate floating-point output in fixed-point notation, slay.static const fmtflags floatfieldโ a mask ofscientific|fixed. Useful for the 2-arg form ofsetf, iconic.static const iostate goodbitโ indicates all is well, we love that ๐static const fmtflags hexโ converts integer input or generates integer output in hexadecimal base, no cap.static const openmode inโ open for input. Default forifstreamandfstream, periodt.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, bye space ๐static const openmode truncโ truncate an existing stream when opening. Default forofstream, โ๏ธstatic const fmtflags unitbufโ flushes output after each output operation, periodt.static const fmtflags uppercaseโ replaces certain lowercase letters with their uppercase equivalents in generated output, SLAY ๐
โจ 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 ()template<typename _ValueT> __ostream_type & _M_insert (_ValueT __v)void _M_move (ios_base &) noexceptvoid _M_swap (ios_base &__rhs) noexceptvoid init (basic_streambuf< _CharT, _Traits > *__sb)โ all setup is performed here, periodt ๐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_iostream &__rhs)void swap (basic_istream &__rhs)void swap (basic_ostream &__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_fstream< _CharT, _Traits >"Controlling input and output
for files.
Template Parameters
_CharTโ type of character stream._Traitsโ traits for character type, defaults tochar_traits<_CharT>.
This class supports reading from and writing to named files, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as sb. ๐
๐ Member Typedef Documentation ๐
okay bestie, let's get into the typedefs, because they're lowkey the blueprint for everything else. no cap. โจ
typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]
This is literally the type of an event callback function. it's giving function pointer realness. ๐
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(). so yeah, they show up in those moments. ๐ซถ
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
that's the whole list, periodt. ๐
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
vibe check: four flags, no extras. ๐
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
these are your file-opening moods, bestie. ๐โจ
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.
so cur and end are giving C standard library energy, iykyk. ๐ฆ
๐ธ 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(). that's the whole event lineup. ๐
โจ Constructor & Destructor Documentation โจ
template<typename _CharT, typename _Traits> std::basic_fstream< _CharT, _Traits >::basic_fstream () [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). so it's just sitting there, pretty, not touching any files. iconic. ๐
template<typename _CharT, typename _Traits> std::basic_fstream< _CharT, _Traits >::basic_fstream (const char * __s, ios_base::openmode __mode = ios_base::in | ios_base::out) [inline], [explicit]
Create an input/output file stream.
Parameters
__sโ Null terminated string specifying the filename.__modeโ Open file in specified mode (seestd::ios_base).
this one's explicit, so no sneaky implicit conversions. periodt. ๐ฅ
template<typename _CharT, typename _Traits> std::basic_fstream< _CharT, _Traits >::basic_fstream (const std::string & __s, ios_base::openmode __mode = ios_base::in | ios_base::out) [inline], [explicit]
Create an input/output file stream.
Parameters
__sโ Null terminated string specifying the filename.__modeโ Open file in specified mode (seestd::ios_base).
same energy, but with std::string. ๐
template<typename _CharT, typename _Traits> template<typename _Path, typename _Require = _If_fs_path<_Path>> std::basic_fstream< _CharT, _Traits >::basic_fstream (const _Path & __s, ios_base::openmode __mode = ios_base::in | ios_base::out) [inline]
Create an input/output file stream.
Parameters
__sโfilesystem::pathspecifying the filename.__modeโ Open file in specified mode (seestd::ios_base).
path vibes only. ๐ค๏ธ
template<typename _CharT, typename _Traits> std::basic_fstream< _CharT, _Traits >::~basic_fstream () [inline]
The destructor does nothing. The file is closed by the filebuf object, not the formatting stream. so don't blame the destructor, bestie. it's just there. ๐ญ
๐ Member Function Documentation ๐
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. lowkey efficient. ๐
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(). that's a whole lot of friends. ๐ซถ
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns True if the badbit is set.
Note that other iostate flags may also be set. so it's a quick yes/no, but not the whole story. ๐
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) to set.
See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument. so default goodbit is usually the move. โจ
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(). busy little function, fr fr. ๐
template<typename _CharT, typename _Traits> void std::basic_fstream< _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 close() is not closing, the stream will let you know. ๐จ
template<typename _CharT, typename _Traits> basic_ios< _CharT, _Traits > & std::basic_ios< _CharT, _Traits >::copyfmt (const basic_ios< _CharT, _Traits > & __rhs) [inherited]
Copies fields of __rhs into this.
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(). it's giving "copy everything except the buffer and state" energy. ๐
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 eofbit is set.
Note that other iostate flags may also be set. so it's not a full diagnosis, just a peek. ๐
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. it's just reading, not setting. periodt. ๐
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.
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);
}
this one's dramatic, bestie. it will literally throw if the flag is already set. ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns True if either the badbit or the failbit is set.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set. so it's a two-for-one check, lowkey. ๐ซถ
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. so usually it's just a lil space. ๐ธ
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. so it's the padding character, no cap. ๐
fmtflags std::ios_base::flags () const [inline], [nodiscard], [inherited]
Access to format flags.
Returns The format control flags for both input and output.
that's the format flag flex, bestie. ๐ฅ
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. It's giving "glow up the whole vibe in one go" โจ
Parameters
__fmtflโ the new flags to set, bestie. All of them. At once. Iconic.
Returns
- The previous format control flags. Like, the receipts from before your makeover ๐
This function overwrites all the format flags with __fmtfl. No merge, no blend, no "can we do both" โ full replacement, periodt.
๐ฆ template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush () [inherited]
Synchronizing the stream buffer. The "okay everyone, actually write the thing down" moment ๐ซถ
Returns
*this
If rdbuf() is a null pointer, changes nothing. Like, nothing happens. Crickets.
Otherwise, it calls rdbuf()->pubsync(), and if that returns -1, it sets badbit. ๐ญ
References std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::flush().
๐ธ template<typename _CharT, typename _Traits> streamsize std::basic_istream< _CharT, _Traits >::gcount () const [inline], [inherited]
Character counting. The "how many did we actually get" check, no cap ๐งฎ
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. Grab one (1) character. Just the one. Very demure.
Returns
- A character, or
eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof(). ๐
References _M_gcount, std::ios_base::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. Passing the vibes along to a whole other buffer ๐
Parameters
__sbโ a streambuf in which to store data.
Returns
*this
Returns get(__sb,widen('\n')). That's it, that's the whole function, slay.
๐ 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. Same energy, but now with a stopping point โ
Parameters
__sbโ a streambuf in which to store data.__delimโ a "stop" character.
Returns
*this
Characters are extracted and inserted into __sb until one of the following happens:
- the input sequence reaches EOF
- insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted)
- the next character equals
__delim(in this case, the character is not extracted) - an exception occurs (and in this case is caught)
If no characters are stored, failbit is set in the stream's error state. ๐ซ
References _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
๐ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type & __c) [inherited]
Simple extraction. One character, one destination, no drama ๐
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, it sets failbit and returns traits::eof().
Note โ This function is not overloaded onsigned charandunsigned char. Just so you know, bestie, don't come for it.
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. Now we're doing a whole squad of characters ๐ซ
Parameters
__sโ pointer to an array.__nโ maximum number of characters to store ins.
Returns
*this
Returns get(__s,__n,widen('\n')). Very "same function, different parameters", we love consistency โจ
๐ 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.
Parameters
__sโ pointer to an array.__nโ maximum number of characters to store in__s.__delimโ a "stop" character.
Returns
*this
Characters are extracted and stored into __s until one of the following happens:
__n-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. That part is not optional, fr fr.
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. Whole-line energy, main character behaviour ๐
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')).
๐ 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. (Yes, it lives somewhere else. We don't gatekeep file paths here.) ๐
๐ง 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 real one. The one that actually has lore.
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. Note that these criteria are required to be tested in the order listed here, to allow an input line to exactly fill the __s array without setting failbit. Order matters, bestie, it's not just a suggestion ๐ฏ
- 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.) โจ
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. Asking "what locale are we in rn" ๐ฃ๏ธ
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::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 vibe check of stream functions ๐
Returns
- True if no error flags are set.
A wrapper around rdstate. Short, sweet, useful.
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. The "I'm choosing not to see this" function ๐
Returns
- A character, or
eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
References _M_gcount, std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sbumpc().
Referenced by std::basic_istream< char_type, traits_type >::ignore().
๐ธ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n) [inherited]
Simple extraction.
Returns
- A character, or
eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
References _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
๐ template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, char __delim) [inline], [inherited]
Simple extraction.
Returns
- A character, or
eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
๐ฅ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, int_type __delim) [inherited]
Discarding characters. The actual one. The one that tells you the real rules ๐
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 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 yes, four whole functions, and it's for performance. Ate. ๐ฅ
References _M_gcount, and std::ios_base::goodbit.
imbue</p> โ the "okay new locale, who dis" function ๐
template<typename _CharT, typename _Traits>
locale std::basic_ios< _CharT, _Traits >::imbue(const locale& __loc) [inherited]
Bestie, this one moves to a new locale. It's giving passport control for your character formatting. ๐ฆ
Parameters
__locโ the new locale. The one we're moving into. โจ
Returns
- The previous locale. Yes, it hands you the old one back, like a lil receipt. ๐
What it actually does: it calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, it calls that buffer's pubimbue(loc) too. So the whole squad gets updated, not just the front desk. ๐
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<<().
init</p> โ the setup era, protected, do not touch ๐
template<typename _CharT, typename _Traits>
void std::basic_ios< _CharT, _Traits >::init(basic_streambuf< _CharT, _Traits >* __sb) [protected], [inherited]
All setup is performed here. Like, all of it. This is called from the public constructor, so it's the behind-the-scenes main character that never takes a bow. ๐ญ
Heads up bestie: it is not virtual and cannot be redefined. So don't come for it, you literally can't override this one. ๐
Referenced by: this list is a whole friend group, so buckle up:
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()std::basic_stringstream< char >::basic_stringstream()
Periodt. That's the whole roster. ๐
is_open</p> โ the vibe check for "is the file even open tho" ๐ซถ
template<typename _CharT, typename _Traits>
bool std::basic_fstream< _CharT, _Traits >::is_open() [inline], [nodiscard]
A lil wrapper to test for an open file. That's it, that's the function. ๐
Returns
rdbuf()->is_open()
It's marked [nodiscard] bestie, so like โ actually use the answer, don't just ghost it. ๐
iword</p> โ integer array access, very demure, very mindful โจ
long& std::ios_base::iword(int __ix) [inline], [inherited]
Parameters
__ixโ index into the array. ๐ข
Returns
- A reference to an integer associated with the index.
Okay so real talk: 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. ๐ธ
โ ๏ธ Two warnings, bestie, listen up: 1. The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. 2. Since the array can grow dynamically, it is not safe to hold onto the reference. It can move on you. Like, the reference is not a forever thing. ๐ญ
References: iword().
Referenced by: iword().
(Yes, it references itself. Iconic self-love behavior honestly. ๐)
narrow</p> โ squeezing characters, respectfully ๐
template<typename _CharT, typename _Traits>
char std::basic_ios< _CharT, _Traits >::narrow(char_type __c, char __dfault) const [inline], [inherited]
Squeezes characters. That's the official description and honestly? It ate. ๐
Parameters
__cโ the character to narrow.__dfaultโ the character to narrow.
Returns
- The narrowed character.
Maps a character of char_type to a character of char, if possible. โจ
Returns the result of:
std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
open</p> โ the file-opening trilogy, part one: the filesystem::path girlie ๐ฆ
template<typename _CharT, typename _Traits>
template<typename _Path>
_If_fs_path< _Path, void > std::basic_fstream< _CharT, _Traits >::open(const _Path& __s,
ios_base::openmode __mode = ios_base::in | ios_base::out) [inline]
Opens an external file. ๐
Parameters
__sโ the name of the file, as afilesystem::path.__modeโ the open mode flags. Defaults toios_base::in | ios_base::out.
Calls std::basic_filebuf::open(__s,__mode). If that function fails, failbit is set in the stream's error state. No cap. ๐
open</p> โ part two: the const char* one, the classic ๐
template<typename _CharT, typename _Traits>
void std::basic_fstream< _CharT, _Traits >::open(const char* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out) [inline]
Opens an external file.
Parameters
__sโ the name of the file.__modeโ the open mode flags. Defaults toios_base::in | ios_base::out.
Calls std::basic_filebuf::open(__s,__mode). If that function fails, failbit is set in the stream's error state. ๐ธ
Referenced by: std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), and std::basic_fstream< char >::open().
open</p> โ part three: the std::string remix ๐
template<typename _CharT, typename _Traits>
void std::basic_fstream< _CharT, _Traits >::open(const std::string& __s,
ios_base::openmode __mode = ios_base::in | ios_base::out) [inline]
Opens an external file.
Parameters
__sโ the name of the file.__modeโ the open mode flags. Defaults toios_base::in | ios_base::out.
Calls std::basic_filebuf::open(__s,__mode). If that function fails, failbit is set in the stream's error state. ๐
operator bool</p> โ the quick-and-easy status check, slay โ
template<typename _CharT, typename _Traits>
std::basic_ios< _CharT, _Traits >::operator bool() const [inline], [explicit], [nodiscard], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... โจ
It's [explicit] and [nodiscard] bestie โ so it won't sneakily convert where you didn't ask, and you gotta use the result. ๐
operator!</p> โ the same vibe check but with a ! ๐
template<typename _CharT, typename _Traits>
bool std::basic_ios< _CharT, _Traits >::operator!() const [inline], [nodiscard], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... ๐
[nodiscard] again โ use the answer, don't waste it. ๐ซถ
operator<<</p> โ the manipulator interface, iomanip girlies rise ๐
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(__ios_type& (* __pf)(__ios_type&))
[inline], [inherited]
Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header. ๐
operator<<</p> โ manipulator interface, the ostream-flavored twin โจ
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(__ostream_type& (* __pf)(__ostream_type&))
[inline], [inherited]
Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header. ๐
operator<<</p> โ extracting from another streambuf, the crossover event ๐ฅ
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits >& std::basic_ostream< _CharT, _Traits >::operator<<(__streambuf_type* __sb)
[inherited]
Extracting from another streambuf. A collab. ๐ค
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. So like, do not pass null, bestie. ๐
Characters are extracted from __sb and inserted into *this until one of the following occurs:
- the input stream reaches end-of-file,
- insertion into the output sequence fails (in this case, the character that would have been inserted is not extracted), or
- an exception occurs while getting a character from
__sb, which setsfailbitin the error state.
If the function inserts no characters, failbit is set. ๐ญ
operator<<</p> โ integer arithmetic inserters, the bool edition ๐
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(bool __n)
[inline], [inherited]
Integer arithmetic inserters. ๐
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 perform numeric formatting. ๐
operator<<</p> โ pointer arithmetic inserters, const void* coded ๐ฆ
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(const void* __p)
[inline], [inherited]
Pointer arithmetic inserters. โจ
Parameters
__pโ a variable of pointer type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting. ๐ธ
operator<<</p> โ floating point inserters, the double one ๐
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(double __f)
[inline], [inherited]
Floating point arithmetic inserters. ๐
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 perform numeric formatting. โจ
operator<<</p> โ floating point inserters, the float remix ๐
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(float __f)
[inline], [inherited]
Floating point arithmetic inserters. ๐
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 perform numeric formatting. ๐ซถ
operator<<</p> โ integer inserters, the int chapter ๐
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits >& std::basic_ostream< _CharT, _Traits >::operator<<(int __n)
[inherited]
Integer arithmetic inserters. โจ
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 perform numeric formatting. ๐
operator<<</p> โ manipulator interface, the ios_base one ๐ฆ
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(ios_base& (* __pf)(ios_base&))
[inline], [inherited]
Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header. ๐
operator<<</p> โ integer inserters, the long era โจ
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(long __n)
[inline], [inherited]
Integer arithmetic inserters. ๐ธ
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 perform numeric formatting. ๐
operator<<</p> โ floating point inserters, the long double moment ๐
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(long double __f)
[inline], [inherited]
Floating point arithmetic inserters. โจ
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 perform numeric formatting. ๐
operator<<</p> โ integer inserters, the long long finale ๐ฅ
template<typename _CharT, typename _Traits>
__ostream_type& std::basic_ostream< _CharT, _Traits >::operator<<(long long __n)
[inline], [inherited]
Integer arithmetic inserters. ๐
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 perform numeric formatting. ๐ซถ
operator<< โ the short inserter ๐
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (short __n) [inherited]
Integer arithmetic inserters, bestie. ๐
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 perform numeric formatting. iykyk
References basic_ostream(), std::ios_base::badbit, std::ostreambuf_iterator< _CharT, _Traits >::failed(), std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet().
operator<< โ unsigned int โจ
template<typename _CharT, typename _Traits>
__ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned int __n) [inline], [inherited]
Integer arithmetic inserters. ๐ฆ
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 perform numeric formatting.
operator<< โ unsigned long ๐ธ
template<typename _CharT, typename _Traits>
__ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long __n) [inline], [inherited]
Integer arithmetic inserters.
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 perform numeric formatting.
operator<< โ unsigned long long ๐
template<typename _CharT, typename _Traits>
__ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long long __n) [inline], [inherited]
Integer arithmetic inserters.
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 perform numeric formatting.
operator<< โ unsigned short ๐ซถ
template<typename _CharT, typename _Traits>
__ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned short __n) [inline], [inherited]
Integer arithmetic inserters.
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 perform numeric formatting.
operator>> โ manipulator interface, __ios_type version ๐
template<typename _CharT, typename _Traits>
__istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__ios_type &(* __pf )(__ios_type &)) [inline], [inherited]
Interface for manipulators. Manipulators like std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more info, see the iomanip header. ๐
operator>> โ manipulator interface, __istream_type version ๐
template<typename _CharT, typename _Traits>
__istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__istream_type &(* __pf )(__istream_type &)) [inline], [inherited]
Interface for manipulators. Manipulators like std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more info, see the iomanip header. ๐
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. Okay so this one's a lil different, bestie.
Parameters
__sbโ a pointer to astreambuf.
This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
If __sb is NULL, the stream will set failbit in its error state. ๐ญ
Characters are extracted from this stream and inserted into the __sb streambuf until one of the following occurs:
- the input stream reaches end-of-file,
- insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted), or
- an exception occurs (and in this case is caught).
If the function inserts no characters, failbit is set.
References std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
operator>> โ bool extractor ๐
template<typename _CharT, typename _Traits>
__istream_type & std::basic_istream< _CharT, _Traits >::operator>> (bool & __n) [inline], [inherited]
Integer arithmetic extractors. (Yes, bool living in the integer extractors section, iconic.)
Parameters
__nโ a variable of builtin integral type.
Returns
*this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
operator>> โ double 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.
operator>> โ float 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.
operator>> โ int 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.
operator>> โ manipulator interface, ios_base version ๐
template<typename _CharT, typename _Traits>
__istream_type & std::basic_istream< _CharT, _Traits >::operator>> (ios_base &(* __pf )(ios_base &)) [inline], [inherited]
Interface for manipulators. Manipulators like std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more info, see the iomanip header. ๐
operator>> โ long 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.
operator>> โ long double 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.
operator>> โ long long 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.
operator>> โ short extractor ๐
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::num_get< _CharT, _InIter >::get(), std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet().
operator>> โ unsigned int 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.
operator>> โ unsigned long 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.
operator>> โ unsigned long long 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.
operator>> โ unsigned short 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.
operator>> โ void * extractor ๐ฆ
template<typename _CharT, typename _Traits>
__istream_type & std::basic_istream< _CharT, _Traits >::operator>> (void *& __p) [inline], [inherited]
Basic arithmetic extractors.
Parameters
__pโ a variable of pointer type.
Returns
*this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
peek โ looking ahead in the stream ๐ฅ
template<typename _CharT, typename _Traits>
basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::peek (void ) [inherited]
Looking ahead in the stream. Not me peeking without committing, main character energy fr. ๐
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. ๐
References _M_gcount, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdbuf().
precision โ the getter ๐ธ
streamsize std::ios_base::precision () const [inline], [nodiscard], [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. ๐ญ lowkey a trap, bestie.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().
precision โ the setter ๐ธ
streamsize std::ios_base::precision (streamsize __prec) [inline], [inherited]
Changing flags.
Parameters
__precโ the new precision value, bestie ๐
Returns
- the previous value of
precision()โจ
๐ธ put โ simple insertion (inherited)
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
& std::basic_ostream< _CharT, _Traits >::put (char_type __c) [inherited]
okay so it literally just tries to insert __c. that's the whole job ๐
Parameters
__cโ the character to insert.
Returns
*this
Tries to insert __c.
Note โ this function is not overloaded onsigned charandunsigned char. so don't come for it ๐
References std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::endl(), and std::ends().
๐ฆ putback โ unextracting a single character (inherited)
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::putback (char_type __c)
[inherited]
Parameters
__cโ the character to push back into the input stream.
Returns
*this
If rdbuf() is not null, it calls rdbuf()->sputbackc(c).
If rdbuf() is null, or if sputbackc() fails, it sets badbit in the error state. no cap ๐ญ
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(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_streambuf< _CharT, _Traits >::sputbackc().
Referenced by std::operator<<().
๐ pword โ access to the void pointer array (inline, inherited)
void *& std::ios_base::pword (int __ix) [inline], [inherited]
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 โ she's slippery, don't get attached ๐
๐ basic_fstream::rdbuf โ accessing the underlying buffer (inline, nodiscard)
template<typename _CharT, typename _Traits> __filebuf_type *
std::basic_fstream< _CharT, _Traits >::rdbuf () const [inline],
[nodiscard]
Returns
- the current
basic_filebufbuffer.
This hides both signatures of std::basic_ios::rdbuf(). sneaky little icon ๐ซถ
๐ basic_ios::rdbuf โ changing the underlying buffer (inherited)
template<typename _CharT, typename _Traits> basic_streambuf< _CharT, _Traits
> * std::basic_ios< _CharT, _Traits >::rdbuf (basic_streambuf< _CharT,
_Traits > * __sb) [inherited]
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. For example:
std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>
References clear().
โญ rdstate โ returns the error state of the stream buffer (inline, nodiscard, inherited)
template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT,
_Traits >::rdstate () const [inline], [nodiscard], [inherited]
Returns
- a bit pattern (well, isn't everything?) ๐
See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().
Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
๐ read โ extraction without delimiters (inherited)
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::read (char_type * __s,
streamsize __n) [inherited]
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 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. ngl that's just how it is ๐
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().
๐ง readsome โ extraction until the buffer is exhausted, but no more (inherited)
template<typename _CharT, typename _Traits> streamsize std::basic_istream<
_CharT, _Traits >::readsome (char_type * __s, streamsize __n)
[inherited]
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. lowkey a vibe ๐ธ
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().
๐ฅ register_callback โ add the callback __fn with parameter __index (inherited)
void std::ios_base::register_callback (event_callback __fn, int __index)
[inherited]
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, bestie ๐
๐ seekg โ changing the current read position (inherited)
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::seekg (off_type __off,
ios_base::seekdir __dir) [inherited]
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(). she minds her own business ๐
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().
โจ seekg โ changing the current read position (inherited)
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::seekg (pos_type __pos)
[inherited]
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().
๐ซถ seekp โ changing the current write position (inherited)
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
& std::basic_ostream< _CharT, _Traits >::seekp (off_type __off,
ios_base::seekdir __dir) [inherited]
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.
References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
๐ seekp โ changing the current write position (inherited)
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
& std::basic_ostream< _CharT, _Traits >::seekp (pos_type __pos)
[inherited]
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.
References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
๐ setf โ setting new format flags (inline, inherited)
fmtflags std::ios_base::setf (fmtflags __fmtfl) [inline], [inherited]
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. no takebacks ๐
Referenced by std::__detail::operator>>().
๐ setf โ setting new format flags (inline, inherited)
fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline],
[inherited]
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.
๐ฆ setstate โ sets additional flags in the error state (inline, inherited)
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT,
_Traits >::setstate (iostate __state) [inline], [inherited]
Parameters
__stateโ the additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
Alright, so this next bit is the tail end of the receipts from the entry above โ every single one of these cuties calls into it, and we're listing them ALL, no skips:
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()
๐ sync โ synchronizing the stream buffer
template<typename _CharT, typename _Traits>
int std::basic_istream< _CharT, _Traits >::sync (void ) [inherited]
Bestie, this one talks to the actual buffer underneath and asks it to get its life together. ๐
Returns: 0 on success, -1 on failure.
So here's the tea, step by step:
- If
rdbuf()is a null pointer, it returns-1. That's it, that's the whole vibe, no buffer no sync. - Otherwise it calls
rdbuf()->pubsync(), and if THAT comes back-1, it setsbadbitand returns-1. ๐ - Otherwise, returns
0. Slay.
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().
๐ sync_with_stdio โ the C / C++ crossover episode
bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]
Interaction with the standard C I/O objects. It's giving collab. ๐ซถ
Parameters:
__syncโ Whether to synchronize or not.
Returns: True if the standard streams were previously synchronized.
So important, bestie: the synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary
๐ tellg โ where am I reading rn
template<typename _CharT, typename _Traits>
basic_istream< _CharT, _Traits >::pos_type std::basic_istream< _CharT, _Traits >::tellg (void ) [inherited]
Getting the current read position. Iconic behavior, honestly. โจ
Returns: A file position object.
If fail() is not false, it returns pos_type(-1) to indicate failure. Otherwise it returns rdbuf()->pubseekoff(0,cur,in).
Note: this function does not count the number of characters extracted, if any, and therefore does not affect the next call togcount(). 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().
โ๏ธ tellp โ where am I writing rn
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp () [inherited]
Getting the current write position. Twin sister of tellg but for output. ๐
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,out).
References: std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::out, and std::basic_ios< _CharT, _Traits >::rdbuf().
๐ tie() (const) โ who's holding my hand
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [nodiscard], [inherited]
Fetches the current tied stream. Cute little handhold. ๐ซถ
Returns: A pointer to the tied stream, or NULL if the stream is not tied.
So here's the concept: 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. Main character energy fr fr. ๐
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and copyfmt().
๐ tie(basic_ostream*) โ making it official
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. It's a situationship no more. ๐
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. (Yes, it's self-referential, we love a circular reference, iconic.)
โฉ๏ธ unget โ undo, put it back
template<typename _CharT, typename _Traits>
basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::unget (void ) [inherited]
Unextracting the previous character. Giving the character back like "jk bestie, you can have it". ๐
Returns: *this
- If
rdbuf()is not null, it callsrdbuf()->sungetc(c). - If
rdbuf()is null or ifsungetc()fails, it setsbadbitin the error state. ๐
Note: this function first clearseofbit. Since no characters are extracted, the next call togcount()will return0, as required by DR 60.
References: _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), and std::basic_streambuf< _CharT, _Traits >::sungetc().
Referenced by std::__detail::operator>>().
๐งน unsetf โ clearing format flags
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.
๐ widen โ making chars bigger
template<typename _CharT, typename _Traits>
char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited]
Widens characters. Glow-up but for 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>>().
๐ width() (getter) โ flags access
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. (Yes, characters, not pixels, not vibes.)
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
๐ width(streamsize) โ changing flags
streamsize std::ios_base::width (streamsize __wide) [inline], [inherited]
Changing flags. New width, who dis. ๐
Parameters:
__wideโ The new width value.
Returns: The previous value of width().
๐๏ธ write โ character string insertion
template<typename _CharT, typename _Traits>
basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::write (const char_type * __s, streamsize __n) [inherited]
Character string insertion. The big one, the moment, the slay. ๐ฅ
Parameters:
__sโ The array to insert.__nโ Maximum number of characters to insert.
Returns: *this
Characters are copied from __s and inserted into the stream until one of the following happens:
__ncharacters are inserted- inserting into the output sequence fails (in this case,
badbitwill be set in the stream's error state)
Note: this function is not overloaded onsigned charandunsigned char. (Justice for the signed/unsigned girlies, we guess.)
๐๏ธ xalloc โ access to unique indices
int std::ios_base::xalloc () [static], [inherited]
Access to unique indices.
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. No cap. โญ
๐ Member Data Documentation ๐
๐ข _M_gcount
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().
Referenced by get(), get(), get(), get(), ignore(), ignore(), ignore(), peek(), putback(), read(), readsome(), and unget().
๐ซฑ adjustfield
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().
๐ app
const openmode std::ios_base::app [static], [inherited]
Seek to end before each write. Every single time. Relentless. ๐
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().
๐ ate
const openmode std::ios_base::ate [static], [inherited]
Open and seek to end immediately after opening. One and done, no repeats. โจ
Referenced by std::basic_filebuf< _CharT, _Traits >::open().
๐ badbit
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). It's giving irrecoverable, bestie, this one is genuinely not okay. ๐ญ
okay so the reference list from the entry above just keeps going, and then we slide right into the next batch of inherited std::ios_base constants. we're still deep in the member-data zone, bestie, and these are all the static, inherited little legends that std::basic_fstream gets handed down from std::ios_base. โจ
Referenced by: (still finishing the previous constant's list โ no cap, it's a long one)
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_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()std::ws()
const fmtflags std::ios_base::basefield [static], [inherited]
A mask of dec|oct|hex. useful for the 2-arg form of setf. slay, it's literally just a lil combo pack of number bases ๐
Referenced by:
std::dec()std::num_get< _CharT, _InIter >::do_get()std::num_put< _CharT, _OutIter >::do_put()std::hex()std::oct()
const seekdir std::ios_base::beg [static], [inherited]
asking for a seek that's relative to the beginning of the stream. like, take me back to the start ๐
Referenced by:
std::basic_filebuf< _CharT, _Traits >::seekpos()
const openmode std::ios_base::binary [static], [inherited]
does input and output in binary mode (as opposed to text mode). and bestie, hear me โ this is probably not what you think it is, fr fr. go read the link, it's giving important:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary
Referenced by:
std::basic_filebuf< _CharT, _Traits >::showmanyc()
const fmtflags std::ios_base::boolalpha [static], [inherited]
inserts/extracts bool in alphabetic format instead of numeric format. so true/false instead of 1/0, iconic behaviour honestly ๐ฆ
Referenced by:
std::boolalpha()std::num_get< _CharT, _InIter >::do_get()std::num_put< _CharT, _OutIter >::do_put()std::noboolalpha()
const seekdir std::ios_base::cur [static], [inherited]
asks for a seek relative to the current position inside the sequence. main character energy: 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()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 10 girlies rise ๐
Referenced by:
std::dec()std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>
const seekdir std::ios_base::end [static], [inherited]
asks for a seek relative to the current end of the sequence. going to the end like the last episode of a show you're obsessed with ๐ญ
Referenced by:
std::basic_filebuf< _CharT, _Traits >::open()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()
const iostate std::ios_base::eofbit [static], [inherited]
flags that an input operation hit the end of an input sequence. it's the "that's all folks" bit ๐ฌ
Referenced by:
std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::num_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get_date()std::time_get< _CharT, _InIter >::do_get_monthname()std::time_get< _CharT, _InIter >::do_get_time()std::time_get< _CharT, _InIter >::do_get_weekday()std::time_get< _CharT, _InIter >::do_get_year()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::time_get< _CharT, _InIter >::get()std::basic_istream< _CharT, _Traits >::ignore()std::basic_istream< _CharT, _Traits >::operator>>()std::operator>>()std::basic_istream< _CharT, char_traits< _CharT > >::peek()std::basic_istream< _CharT, _Traits >::putback()std::basic_istream< _CharT, _Traits >::read()std::basic_istream< _CharT, _Traits >::readsome()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, char_traits< _CharT > >::seekg()std::basic_istream< _CharT, _Traits >::unget()std::basic_istream< _CharT, char_traits< _CharT > >::unget()std::ws()
const iostate std::ios_base::failbit [static], [inherited]
flags that an input operation failed to read the characters it expected, OR that an output operation failed to generate the characters it wanted. the "we tried and it did not eat" bit ๐
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]
generates floating-point output in fixed-point notation. no sci-notation drama, just decimals ๐
Referenced by:
std::fixed()std::hexfloat()
const fmtflags std::ios_base::floatfield [static], [inherited]
a mask of scientific|fixed. useful for the 2-arg form of setf. another lil combo pack for your float formatting needs ๐ธ
Referenced by:
std::defaultfloat()std::fixed()std::hexfloat()std::scientific()
const iostate std::ios_base::goodbit [static], [inherited]
indicates all is well. the vibe check passed, no red flags, we're thriving ๐ซถ
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]
converts integer input โ or generates integer output โ in hexadecimal base. base 16 girlies, this one's for you ๐
Referenced by:
std::num_get< _CharT, _InIter >::do_get()std::num_put< _CharT, _OutIter >::do_put()std::hex()
const openmode std::ios_base::in [static], [inherited]
open for input. it's the default for ifstream and fstream, so you literally don't even have to ask ๐
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]
adds fill characters at a designated internal point in certain generated output โ or, if no such point is designated, it's identical to right. so it's giving "right but make it quirky" ๐
Referenced by:
std::internal()
const fmtflags std::ios_base::left [static], [inherited]
adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.). yes bestie, "left" means the padding goes right, iykyk ๐ญ
Referenced by:
std::num_put< _CharT, _OutIter >::do_put()std::left()std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<
const fmtflags std::ios_base::oct [static], [inherited]
converts integer input โ or generates integer output โ in octal base. base 8, the underrated one ๐
Referenced by:
std::oct()
const openmode std::ios_base::out [static], [inherited]
okay so this one is literally the "yes we're writing, bestie" flag ๐
Open for output. It's the default for ofstream and fstream, so those two just show up already in write mode like the main characters they are. ๐
Referenced by (and bestie the list is long, we love a popular icon):
std::basic_fstream< char >::basic_fstream(),std::basic_fstream< char >::basic_fstream(),std::basic_fstream< char >::basic_fstream()std::basic_ofstream< char >::basic_ofstream(),std::basic_ofstream< char >::basic_ofstream(),std::basic_ofstream< char >::basic_ofstream()std::basic_ostringstream< char >::basic_ostringstream()std::basic_stringbuf< char >::basic_stringbuf()std::basic_stringstream< char >::basic_stringstream()std::basic_filebuf< char_type, traits_type >::_M_set_buffer()std::basic_fstream< char >::open(),std::basic_fstream< char >::open(),std::basic_fstream< char >::open()std::basic_ofstream< char >::open(),std::basic_ofstream< char >::open(),std::basic_ofstream< char >::open()std::basic_filebuf< _CharT, _Traits >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail()std::basic_streambuf< char_type, traits_type >::pubseekoff()std::basic_streambuf< char_type, traits_type >::pubseekpos()std::basic_streambuf< char_type, traits_type >::seekoff()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()std::basic_stringbuf< char >::seekoff()std::basic_ostream< _CharT, _Traits >::seekp(),std::basic_ostream< _CharT, _Traits >::seekp()std::basic_streambuf< char_type, traits_type >::seekpos()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()std::basic_stringbuf< char >::seekpos()std::basic_ostream< _CharT, _Traits >::tellp()- and
std::basic_filebuf< _CharT, _Traits >::xsputn()
const fmtflags std::ios_base::right [static], [inherited]
puts the fill characters on the left (the initial positions) of certain generated output. Basically: the thing you print is flush right. โจ So it's giving "text aligned to the right edge, filler holding down the left" โ very neat, very demure.
Referenced by:
std::right()
const fmtflags std::ios_base::scientific [static], [inherited]
generates floating-point output in scientific notation. ๐งช tiny numbers, big drama, e everywhere.
Referenced by:
std::hexfloat(), andstd::scientific()
const fmtflags std::ios_base::showbase [static], [inherited]
generates a prefix that tells you the numeric base of the generated integer output. so like, the lil 0x moment ๐ so you know what you're looking at.
Referenced by:
std::num_put< _CharT, _OutIter >::do_put(),std::noshowbase(), andstd::showbase()
const fmtflags std::ios_base::showpoint [static], [inherited]
generates a decimal-point character unconditionally in generated floating-point output. no "hmm should I show the dot" โ the dot is always there. periodt. ๐
Referenced by:
std::noshowpoint(), andstd::showpoint()
const fmtflags std::ios_base::showpos [static], [inherited]
generates a + sign in non-negative generated numeric output. so your positives get to feel special too ๐ซถ no cap.
Referenced by:
std::noshowpos(), andstd::showpos()
const fmtflags std::ios_base::skipws [static], [inherited]
skips leading white space before certain input operations. it's literally the "ignore the noise, we're reading now" vibe check ๐ธ
Referenced by:
std::noskipws(),std::__detail::operator>>(),std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, andstd::skipws()
const openmode std::ios_base::trunc [static], [inherited]
truncate an existing stream when opening. It's the default for ofstream.
โ ๏ธ bestie. truncate. as in, the old contents? gone. evaporated. not coming back. ๐ณ๏ธ If you didn't mean to wipe it, you did now. Be so careful with this one fr fr.
const fmtflags std::ios_base::unitbuf [static], [inherited]
flushes output after each output operation. every single one. it does not wait, it does not hold, it is impatient in the most iconic way ๐ญ๐ฅ
Referenced by:
std::basic_ostream< _CharT, _Traits >::sentry::~sentry(),std::nounitbuf(), andstd::unitbuf()
const fmtflags std::ios_base::uppercase [static], [inherited]
replaces certain lowercase letters with their uppercase equivalents in generated output. LOUDER. ๐ฃ slay.
Referenced by:
std::num_put< _CharT, _OutIter >::do_put(),std::nouppercase(), andstd::uppercase()
Author ๐
Generated automatically by Doxygen for libstdc++ from the source code.
and that's a wrap on the whole page, bestie ๐ this was part 10 of 10, we made it, we survived the entire flag buffet ๐ everything here came straight from the libstdc++ manual โ std::basic..., _Traits >(3), the one and only โ and the docs themselves were auto-generated by Doxygen from the source code, so shoutout to the machine that wrote my source material โจ ty for reading the whole thing, you ate fr fr ๐๐ฆ
๐ฆ 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