STD::WISTREAM(3)
๐ธ std::basic_istream< _CharT, _Traits >(3) ๐ธ โ Library Functions Manual
โจ NAME โจ
std::basic_istream< _CharT, _Traits > โ bestie, it's the template class basic_istream. That's it. That's the whole vibe. ๐
๐ฆ SYNOPSIS ๐ฆ
#include <istream>
Okay so first things first, this class inherits std::basic_ios< _CharT, _Traits >. Family tree moment. ๐ณ
And it's inherited by a whole friend group: std::basic_ifstream< char >, std::basic_ifstream< wchar_t >, std::basic_iostream< char >, std::basic_iostream< wchar_t >, std::basic_istringstream< char >, std::basic_istringstream< wchar_t >, std::basic_ifstream< _CharT, _Traits >, std::basic_iostream< _CharT, _Traits >, and std::basic_istringstream< _CharT, _Traits, _Alloc >. Iconic lineage fr fr. ๐
๐ Classes
class sentryโ does the setup work for input streams. Think of it as the little pre-game ritual before any extraction happens. It's giving backstage pass. ๐๏ธ
๐ Public Types
typedef ctype< _CharT > __ctype_typetypedef basic_ios< _CharT, _Traits > __ios_typetypedef basic_istream< _CharT, _Traits > __istream_typetypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typetypedef basic_streambuf< _CharT, _Traits > __streambuf_typetypedef _CharT char_typeenum event { erase_event, imbue_event, copyfmt_event }โ the set of events that may be passed to an event callback. Yes queen, these are the events.typedef void(* event_callback) (event __e, ios_base &__b, int __i)โ the type of an event callback function. Basically the shape of the function you hand over. ๐typedef _Ios_Fmtflags fmtflagsโ this is a bitmask type.typedef _Traits::int_type int_typetypedef _Ios_Iostate iostateโ this is a bitmask type too.typedef _Traits::off_type off_typetypedef _Ios_Openmode openmodeโ also a bitmask type. They really said "bitmask" three times, and honestly? Slay.typedef _Traits::pos_type pos_typetypedef _Ios_Seekdir seekdirโ this one's an enumerated type, not a bitmask. Different energy.typedef _Traits traits_typetypedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_type
๐ Public Member Functions
Okay bestie, this is the big list, hydrate before you read it. ๐
basic_istream (__streambuf_type *__sb)โ base constructor. The origin story. ๐ฑvirtual ~basic_istream ()โ base destructor. It says goodbye. ๐ญtemplate<typename _ValueT> basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)const locale & _M_getloc () constโ locale access.void _M_setstate (iostate __state)bool bad () constโ fast error checking. Is it bad? Check fast.void clear (iostate __state=goodbit)โ [re]sets the error state.basic_ios & copyfmt (const basic_ios &__rhs)โ copies the fields of__rhsinto this. Copy-paste but make it โจformatโจ.bool eof () constโ fast error checking.iostate exceptions () constโ throwing exceptions on errors.void exceptions (iostate __except)โ throwing exceptions on errors.bool fail () constโ fast error checking.char_type fill () constโ retrieves the empty character. Not an empty personality, just an empty char. ๐ซถchar_type fill (char_type __ch)โ sets a new empty character.fmtflags flags () constโ access to format flags.fmtflags flags (fmtflags __fmtfl)โ setting new format flags all at once. All at once, no cap.streamsize gcount () constโ character counting.basic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)- These are explicit specialization declarations, defined in
src/istream.cc. ๐
- These are explicit specialization declarations, defined in
locale getloc () constโ locale access.bool good () constโ fast error checking.basic_istream< wchar_t > & ignore (streamsize __n)basic_istream< char > & ignore (streamsize __n)basic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)basic_istream< char > & ignore (streamsize __n, int_type __delim)locale imbue (const locale &__loc)โ moves to a new locale. Glow-up, but for locales. ๐long & iword (int __ix)โ access to integer array.char narrow (char_type __c, char __dfault) constโ squeezes characters.__istream_type & operator>> (__streambuf_type *__sb)โ extracting into another streambuf.__istream_type & operator>> (void *&__p)โ basic arithmetic extractors.streamsize precision () constโ flags access.streamsize precision (streamsize __prec)โ changing flags.void *& pword (int __ix)โ access to void pointer array.basic_streambuf< _CharT, _Traits > * rdbuf () constโ accessing the underlying buffer.basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb)โ changing the underlying buffer.iostate rdstate () constโ returns the error state of the stream buffer.void register_callback (event_callback __fn, int __index)โ add the callback__fnwith parameter__index.fmtflags setf (fmtflags __fmtfl)โ setting new format flags.fmtflags setf (fmtflags __fmtfl, fmtflags __mask)โ setting new format flags.void setstate (iostate __state)โ sets additional flags in the error state.basic_ostream< _CharT, _Traits > * tie () constโ fetches the current tied stream.basic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr)โ ties this stream to an output stream. Literally tying the knot. ๐void unsetf (fmtflags __mask)โ clearing format flags.char_type widen (char __c) constโ widens characters.streamsize width () constโ flags access.streamsize width (streamsize __wide)โ changing flags.__istream_type & operator>> (__istream_type &(*__pf)(__istream_type &))โ interface for manipulators.__istream_type & operator>> (__ios_type &(*__pf)(__ios_type &))โ interface for manipulators.__istream_type & operator>> (ios_base &(*__pf)(ios_base &))โ interface for manipulators.
๐ฅ Extractors
So, all the operator>> functions (aka the formatted input functions) share some common behavior, and you need to know it:
Every single one starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to false. That has several effects, and it all wraps up with the setting of a status flag โ see the sentry documentation for the full tea. โ
If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.
โ ๏ธ If an exception is thrown during extraction,ios_base::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 theexceptionsmask. Not me warning you dramatically, but like, do read that twice. ๐ญ
__istream_type & operator>> (bool &__n)โ integer arithmetic extractors.__istream_type & operator>> (short &__n)โ integer arithmetic extractors.__istream_type & operator>> (unsigned short &__n)โ integer arithmetic extractors.__istream_type & operator>> (int &__n)โ integer arithmetic extractors.__istream_type & operator>> (unsigned int &__n)โ integer arithmetic extractors.__istream_type & operator>> (long &__n)โ integer arithmetic extractors.__istream_type & operator>> (unsigned long &__n)โ integer arithmetic extractors.__istream_type & operator>> (long long &__n)โ integer arithmetic extractors.__istream_type & operator>> (unsigned long long &__n)โ integer arithmetic extractors.__istream_type & operator>> (float &__f)โ floating point arithmetic extractors.__istream_type & operator>> (double &__f)โ floating point arithmetic extractors.__istream_type & operator>> (long double &__f)โ floating point arithmetic extractors.
๐ธ Unformatted Input Functions
Same deal, but different. All the unformatted input functions share some common behavior too:
Each starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true. Several effects follow, concluding with the setting of a status flag โ again, sentry documentation has the details. ๐ง
If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.
The number of characters extracted is stored for later retrieval by gcount(). ๐
โ ๏ธ If an exception is thrown during extraction,ios_base::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 theexceptionsmask. Same warning, same energy, still important.
int_type get ()โ simple extraction.__istream_type & get (char_type &__c)โ simple extraction.__istream_type & get (char_type *__s, streamsize __n, char_type __delim)โ simple multiple-character extraction.__istream_type & get (char_type *__s, streamsize __n)โ simple multiple-character extraction.__istream_type & get (__streambuf_type &__sb, char_type __delim)โ extraction into another streambuf.__istream_type & get (__streambuf_type &__sb)โ extraction into another streambuf.__istream_type & getline (char_type *__s, streamsize __n, char_type __delim)โ string extraction.__istream_type & getline (char_type *__s, streamsize __n)โ string extraction.__istream_type & ignore (streamsize __n, int_type __delim)โ discarding characters.__istream_type & ignore (streamsize __n)โ simple extraction.__istream_type & ignore ()โ simple extraction.__istream_type & ignore (streamsize __n, char __delim)โ simple extraction.int_type peek ()โ looking ahead in the stream. ๐ No touching, just looking.__istream_type & read (char_type *__s, streamsize __n)โ extraction without delimiters.streamsize readsome (char_type *__s, streamsize __n)โ extraction until the buffer is exhausted, but no more. Boundaries, we love to see them. โ__istream_type & putback (char_type __c)โ unextracting a single character.__istream_type & unget ()โ unextracting the previous character.int sync ()โ synchronizing the stream buffer.pos_type tellg ()โ getting the current read position.__istream_type & seekg (pos_type)โ changing the current read position.__istream_type & seekg (off_type, ios_base::seekdir)โ changing the current read position.operator bool () constโ the quick-and-easy status check.bool operator! () constโ the quick-and-easy status check.
๐ Static Public Member Functions
static bool sync_with_stdio (bool __sync=true)โ interaction with the standard C I/O objects.static int xalloc () throw ()โ access to unique indices.
โจ Static Public Attributes โจ
static const openmode __noreplaceโ that's it, that's the attribute, no lil description attached, she simply exists ๐static const fmtflags adjustfieldโ a mask ofleft|right|internal. lowkey a lifesaver for the 2-arg form ofsetf.static const openmode appโ seek to the end before each write. every single one bestie, no skipping.static const openmode ateโ open and seek to the end immediately after opening. it's giving "already at the back of the line" energy.static const iostate badbitโ indicates a loss of integrity in an input or output sequence (like, say, an irrecoverable read error from a file). this is the ๐ flag.static const fmtflags basefieldโ a mask ofdec|oct|hex. perfect for the 2-arg form ofsetf.static const seekdir begโ request a seek relative to the beginning of the stream. back to square one, fr.static const openmode binaryโ perform input and output in binary mode (as opposed to text mode). > this is probably not what you think it is; seehttps://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. no cap, go read it.static const fmtflags boolalphaโ insert/extractboolin alphabetic rather than numeric format. words over numbers, iconic.static const seekdir curโ request a seek relative to the current position within the sequence. right where you left it, bestie.static const fmtflags decโ converts integer input or generates integer output in decimal base.static const seekdir endโ request a seek relative to the current end of the sequence.static const iostate eofbitโ indicates that an input operation reached the end of an input sequence. the end, periodt.static const iostate failbitโ indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. it tried, it flopped ๐ฅฒstatic const fmtflags fixedโ generate floating-point output in fixed-point notation.static const fmtflags floatfieldโ a mask ofscientific|fixed. yes, it's for the 2-arg form ofsetf. you know the drill by now.static const iostate goodbitโ indicates all is well ๐ซถ everything's fine, nothing to see here, she's thriving.static const fmtflags hexโ converts integer input or generates integer output in hexadecimal base.static const openmode inโ open for input. the default forifstreamandfstream.static const fmtflags internalโ adds fill characters at a designated internal point in certain generated output, or identical torightif no such point is designated.static const fmtflags leftโ adds fill characters on the right (final positions) of certain generated output. (i.e., the thing you print is flush left.)static const fmtflags octโ converts integer input or generates integer output in octal base.static const openmode outโ open for output. the 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. science slay ๐ฅstatic const fmtflags showbaseโ generates a prefix indicating the numeric base of generated integer output.static const fmtflags showpointโ generates a decimal-point character unconditionally in generated floating-point output. she said "you WILL see my point".static const fmtflags showposโ generates a+sign in non-negative generated numeric output.static const fmtflags skipwsโ skips leading white space before certain input operations.static const openmode truncโ truncate an existing stream when opening. the default forofstream. bye bye old contents ๐ฅstatic const fmtflags unitbufโ flushes output after each output operation.static const fmtflags uppercaseโ replaces certain lowercase letters with their uppercase equivalents in generated output. LOUDER ๐ข
๐ Protected Types ๐
enum { _S_local_word_size }โ a lil anonymous enum, just vibing, just holding a size.
๐ฆ Protected Member Functions ๐ฆ
basic_istream (basic_istream &&__rhs)basic_istream (const basic_istream &)=deleteโ copy construction? deleted. not today bestie.void _M_cache_locale (const locale &__loc)void _M_call_callbacks (event __ev) throw ()void _M_dispose_callbacks (void) throw ()template<typename _ValueT> __istream_type & _M_extract (_ValueT &__v)_Words & _M_grow_words (int __index, bool __iword)void _M_init () throw ()void _M_move (ios_base &) noexceptvoid _M_swap (ios_base &__rhs) noexceptvoid init (basic_streambuf< _CharT, _Traits > *__sb)โ all setup is performed here. the whole get-ready-with-me moment, right here.void move (basic_ios &&__rhs)void move (basic_ios &__rhs)basic_istream & operator= (basic_istream &&__rhs)basic_istream & operator= (const basic_istream &)=deleteโ copy assignment also deleted. consistency queen ๐void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)void swap (basic_ios &__rhs) noexceptvoid swap (basic_istream &__rhs)
๐ Protected Attributes ๐
_Callback_list * _M_callbacksconst __ctype_type * _M_ctypeiostate _M_exceptionchar_type _M_fillbool _M_fill_initfmtflags _M_flagsstreamsize _M_gcountlocale _M_ios_locale_Words _M_local_word [_S_local_word_size]const __num_get_type * _M_num_getconst __num_put_type * _M_num_putstreamsize _M_precisionbasic_streambuf< _CharT, _Traits > * _M_streambufiostate _M_streambuf_statebasic_ostream< _CharT, _Traits > * _M_tiestreamsize _M_width_Words * _M_wordint _M_word_size_Words _M_word_zero
๐ Friends ๐
class sentryโ that's the whole friend list. just the one. quality over quantity, iykyk.
โญ Detailed Description โญ
template<typename _CharT, typename _Traits>
class std::basic_istream< _CharT, _Traits >
"Template class basic_istream.
๐ Template Parameters ๐
_CharTโ type of character stream._Traitsโ traits for character type, defaults tochar_traits<_CharT>.
This is the base class for all input streams, no cap. It provides text formatting of all builtin types, and it communicates with any class derived from basic_streambuf to do the actual input. so basically she's the main character and the streambuf does the running around behind the scenes ๐
โจ Member Typedef Documentation โจ
template<typename _CharT, typename _Traits> typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_put_type [inherited]
These are non-standard types. yeah. non-standard. she's special like that ๐
typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]
The type of an event callback function. so this is the shape of a function that gets pinged when stuff goes down.
Parameters, bestie:
__eโ one of the members of 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().
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
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
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
typedef _Ios_Seekdir std::ios_base::seekdir [inherited]
This is an enumerated type. _Ios_Seekdir is implementation-defined. Defined values of type seekdir are:
begcur, equivalent toSEEK_CURin the C standard library.end, equivalent toSEEK_ENDin the C standard library.
๐ธ Member Enumeration Documentation ๐ธ
enum std::ios_base::event [inherited]
The set of events that may be passed to an event callback. erase_event is used during ~ios() and copyfmt(). imbue_event is used during imbue(). copyfmt_event is used during copyfmt(). three lil events, three lil moments, all iconic ๐
๐ซ Constructor & Destructor Documentation ๐ซ
template<typename _CharT, typename _Traits> std::basic_istream< _CharT, _Traits >::basic_istream (__streambuf_type * __sb) [inline], [explicit]
Base constructor. This ctor is almost never called by the user directly, rather from derived classes' initialization lists, which pass a pointer to their own stream buffer.
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry().
template<typename _CharT, typename _Traits> virtual std::basic_istream< _CharT, _Traits >::~basic_istream () [inline], [virtual]
Base destructor. This does very little apart from providing a virtual base dtor. she's chill like that, does her one job and dips ๐ฆ
๐ฅ Member Function Documentation ๐ฅ
const locale & std::ios_base::_M_getloc () const [inline], [inherited]
Locale access. she's your plug for the current locale.
Returns: a reference to the current locale.
Like getloc above, but returns a reference instead of generating a copy. so she's the efficient version, no unnecessary copying, very demure.
Referenced by std::money_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put(). literally everyone wants a piece of her.
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [nodiscard], [inherited]
Fast error checking. quick lil vibe check on whether things went wrong.
Returns: true if the badbit is set.
heads up: otheriostateflags may also be set. sobad()saying true doesn't mean the others are quiet, bestie.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry().
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]
[Re]sets the error state. reset era ๐
Parameters:
__stateโ the new state flag(s) to set.
See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument โ the default goodbit is doing the heavy lifting for you.
References std::ios_base::badbit, exceptions(), rdbuf(), and rdstate().
Referenced by:
std::basic_ios< char_type, traits_type >::exceptions()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::__detail::operator>>()std::basic_istream< _CharT, _Traits >::putback()rdbuf()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_ios< char_type, traits_type >::setstate()std::basic_istream< _CharT, _Traits >::unget()
okay bestie yes open() is listed twice per stream and no I did not do a typo, that's literally what the docs say ๐ซถ moving on.
copyfmt โ the glow-up montage ๐
template<typename _CharT, typename _Traits> basic_ios< _CharT, _Traits > &
std::basic_ios< _CharT, _Traits >::copyfmt (const basic_ios< _CharT,
_Traits > & __rhs) [inherited]
Copies fields of __rhs into this. It's giving "make this stream look exactly like that stream" energy โจ
Parameters
__rhsโ The source values for the copies.
Returns
- Reference to this object.
So here's the tea: all fields of __rhs get copied into this object, except rdbuf() and rdstate() โ those two stay exactly as they were, no touchy ๐
โโ๏ธ. All values in the pword and iword arrays get copied too. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. And the grand finale? The final step is to copy exceptions().
References: basic_ios(), std::__addressof(), exceptions(), fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), tie(), std::tie(), and std::ios_base::width().
eof โ vibe check, but for end-of-file ๐ธ
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::eof () const [inline], [nodiscard], [inherited]
Fast error checking. Like, speedrun edition ๐โโ๏ธ
Returns
- True if the
eofbitis set.
heads up bestie: otheriostateflags may also be set.eofbeing true does NOT mean everything else is chill ๐ญ
exceptions (the const one) โ mask reveal ๐
template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT,
_Traits >::exceptions () const [inline], [nodiscard], [inherited]
Throwing exceptions on errors.
Returns
- The current exceptions mask.
This changes nothing in the stream โ it's a read-only peek, no notes taken ๐. See the one-argument version of exceptions(iostate) for the meaning of the return value.
Referenced by: clear(), and copyfmt().
exceptions (the setter one) โ now you're setting the mask ๐
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT,
_Traits >::exceptions (iostate __except) [inline], [inherited]
Throwing exceptions on errors.
Parameters
__exceptโ The new exceptions mask.
So by default, error flags are set silently. Like, no drama, they just sit there ๐ถ. But you can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown. periodt.
careful babe: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. no waiting, no chill, instant chaos ๐ฅ
Try running the following under GCC 3.1 or later:
#include <iostream>
#include <fstream>
#include <exception>
int main()
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
std::ifstream f ("/etc/motd");
std::cerr << "Setting badbit\n";
f.setstate (std::ios_base::badbit);
std::cerr << "Setting exception mask\n";
f.exceptions (std::ios_base::badbit);
}
fail โ another fast error check, we love consistency โจ
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::fail () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns
- True if either the
badbitor thefailbitis set.
Fun little lore drop: checking the badbit in fail() is historical practice ๐. And again โ note that other iostate flags may also be set.
Referenced by: std::basic_ios< char_type, traits_type >::operator bool(), std::basic_ios< char_type, traits_type >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
fill (getter) โ the empty character, she's so iconic ๐
template<typename _CharT, typename _Traits> char_type std::basic_ios<
_CharT, _Traits >::fill () const [inline], [nodiscard], [inherited]
Retrieves the empty character.
Returns
- The current fill character.
It defaults to a space (' ') in the current locale. simple as that ๐
Referenced by: copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
fill (setter) โ new character just dropped ๐ฆ
template<typename _CharT, typename _Traits> char_type std::basic_ios<
_CharT, _Traits >::fill (char_type __ch) [inline], [inherited]
Sets a new empty character.
Parameters
__chโ The new character.
Returns
- The previous fill character.
Okay so here's when the fill character even matters: it's used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. And yeah, it defaults to a space (' ') in the current locale.
flags (getter) โ format flags, come get y'all ๐ง
fmtflags std::ios_base::flags () const [inline], [nodiscard], [inherited]
Access to format flags.
Returns
- The format control flags for both input and output.
Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
(yes that's a lot of std::operator>>() in a row. the docs said it, I said it, we move ๐)
flags (setter) โ swap the whole vibe in one go ๐
fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once.
Parameters
__fmtflโ The new flags to set.
Returns
- The previous format control flags.
heads up: this function overwrites all the format flags with __fmtfl. it's not a merge, it's a full replace, no survivors ๐ฅ
gcount โ how many characters did we just eat? ๐
template<typename _CharT, typename _Traits> streamsize std::basic_istream<
_CharT, _Traits >::gcount () const [inline]
Character counting.
Returns
- The number of characters extracted by the previous unformatted input function dispatched for this stream.
get โ simple extraction ๐
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits
>::int_type std::basic_istream< _CharT, _Traits >::get (void )
Simple extraction.
Returns
- A character, or
eof().
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by: std::basic_istream< char_type, traits_type >::get(), and std::basic_istream< char_type, traits_type >::get().
get โ extraction into another streambuf ๐ฆ
template<typename _CharT, typename _Traits> __istream_type &
std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb)
[inline]
Extraction into another streambuf.
Parameters
__sbโ A streambuf in which to store data.
Returns
*this
Returns get(__sb,widen('\n')). cute little delegation moment โจ
get โ extraction into another streambuf, with a stop character ๐ธ
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb,
char_type __delim)
Extraction into another streambuf.
Parameters
__sbโ A streambuf in which to store data.__delimโ A "stop" character.
Returns
*this
Characters are extracted and inserted into __sb until one of the following happens:
- the input sequence reaches EOF
- insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted)
- the next character equals
__delim(in this case, the character is not extracted) - an exception occurs (and in this case is caught)
if no characters are stored, failbit is set in the stream's error state. ๐ญ
References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
get โ simple extraction, single character ๐
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::get (char_type & __c)
Simple extraction.
Parameters
__cโ The character in which to store data.
Returns
*this
Tries to extract a character and store it in __c. If none are available, sets failbit and returns traits::eof().
Note: This function is not overloaded onsigned charandunsigned char. like, at all. don't come for me ๐
References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
get โ multiple characters, go off ๐
template<typename _CharT, typename _Traits> __istream_type &
std::basic_istream< _CharT, _Traits >::get (char_type * __s, streamsize
__n) [inline]
Simple multiple-character extraction.
Parameters
__sโ Pointer to an array.__nโ Maximum number of characters to store in s.
Returns
*this
Returns get(__s,__n,widen('\n')). again with the delegation, we love a wrapper ๐
get โ multiple characters with a stop character ๐
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::get (char_type * __s,
streamsize __n, char_type __delim)
Simple multiple-character extraction.
Parameters
__sโ Pointer to an array.__nโ Maximum number of characters to store in__s.__delimโ A "stop" character.
Returns
*this
Characters are extracted and stored into __s until one of the following happens:
__n-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. ๐
And in any case, a null character is stored into the next location in the array. always. no exceptions bestie.
Note: This function is not overloaded onsigned charandunsigned char.
References: _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
getline โ string extraction, the moment we've all been waiting for โจ
template<typename _CharT, typename _Traits> __istream_type &
std::basic_istream< _CharT, _Traits >::getline (char_type * __s,
streamsize __n) [inline]
String extraction.
Parameters
__sโ A character array in which to store the data.__nโ Maximum number of characters to extract.
Returns
*this
Returns getline(__s,__n,widen('\n')).
getline โ the char specialization ๐
basic_istream< char > & std::basic_istream< char >::getline (char_type *
__s, streamsize __n, char_type __delim)
Explicit specialization declarations, defined in src/istream.cc. that's the whole thing, she's special and she knows it ๐
getline โ the template one, back at it again ๐ซถ
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >
& std::basic_istream< _CharT, _Traits >::getline (char_type * __s,
streamsize __n, char_type __delim)
String extraction.
Parameters
__sโ a character array in which to store the data ๐พ__nโ maximum number of characters to extract__delimโ a "stop" character ๐
Returns
*this ๐ซถ
So it extracts and stores characters into __s until one of the following happens. And bestie, note that these criteria are required to be tested in the order listed here โ that's the whole reason an input line can exactly fill the __s array without setting failbit. Order is the moment, ok? ๐
- 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 โ which is honestly so valid of it. ๐ธ)
In any case, a null character is stored in the next location in the array. ๐
Referenced by std::basic_istream< char_type, traits_type >::getline().
locale std::ios_base::getloc () const [inline], [nodiscard], [inherited]
Locale access. ๐
Returns
A copy of the current locale.
So if imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. Either way you get a locale, periodt.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::basic_ios< _CharT, _Traits >::imbue(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::good () const [inline], [nodiscard], [inherited]
Fast error checking. โก
Returns
True if no error flags are set.
It's literally just a wrapper around rdstate. Simple. Clean. Iconic. ๐
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (void )
Simple extraction.
Returns
A character, or eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
References _M_gcount, std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sbumpc().
Referenced by std::basic_istream< char_type, traits_type >::ignore().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n)
Simple extraction.
Returns
A character, or eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
References _M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, char __delim) [inline]
Simple extraction.
Returns
A character, or eof().
Tries to extract a character. If none are available, it sets failbit and returns traits::eof().
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, int_type __delim)
Discarding characters. ๐๏ธโจ
Parameters
__nโ number of characters to discard__delimโ a "stop" character
Returns
*this
Extracts characters and throws them away until one of the following happens:
- if
__n != std::numeric_limits<int>::max(),__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. ๐ not them optimizing the overloads
References _M_gcount, and std::ios_base::goodbit.
template<typename _CharT, typename _Traits> locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]
Moves to a new locale. ๐ฆ
Parameters
__locโ the new locale
Returns
The previous locale.
Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc).
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
References std::ios_base::getloc(), std::ios_base::imbue(), and rdbuf().
Referenced by std::chrono::operator<<().
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]
All setup is performed here. This is called from the public constructor. It is not virtual and cannot be redefined. ๐ซ (main character energy, refuses to be overridden)
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().
long & std::ios_base::iword (int __ix) [inline], [inherited]
Access to integer array. ๐ข
Parameters
__ixโ index into the array
Returns
A reference to an integer associated with the index.
The iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0.
The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. ๐ don't be out here keeping stale refs bestie
References iword().
Referenced by iword().
template<typename _CharT, typename _Traits> char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]
Squeezes characters. ๐ง
Parameters
__cโ the character to narrow__dfaultโ the character to narrow
Returns
The narrowed character.
Maps a character of char_type to a character of char, if possible.
Returns the result of
std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
template<typename _CharT, typename _Traits> std::basic_ios< _CharT, _Traits >::operator bool () const [inline], [explicit], [nodiscard], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::operator! () const [inline], [nodiscard], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... ๐
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__ios_type &(* __pf )(__ios_type &)) [inline]
Interface for manipulators. ๐๏ธ Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header.
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__istream_type &(* __pf )(__istream_type &)) [inline]
Interface for manipulators. ๐๏ธ Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header.
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::operator>> (__streambuf_type * __sb)
Extracting into another streambuf. ๐ฐ
Parameters
__sbโ a pointer to a streambuf
This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
If__sbisNULL, the stream will setfailbitin its error state. ๐
Characters are extracted from this stream and inserted into the __sb streambuf until one of the following occurs:
- the input stream reaches end-of-file,
- insertion into the output buffer fails (in this case, the character that would have been inserted is not extracted), or
- an exception occurs (and in this case is caught)
If the function inserts no characters, failbit is set.
References std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (bool & __n) [inline]
Integer arithmetic extractors. ๐ข
Parameters
__nโ a variable of builtin integral type
Returns
*this if successful
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (double & __f) [inline]
Floating point arithmetic extractors. ๐งฎ
Parameters
__fโ a variable of builtin floating point type
Returns
*this if successful
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
template<typename _CharT, typename _Traits> __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (float & __f) [inline]
Floating point arithmetic extractors. ๐งฎ
Parameters
__fโ a variable of builtin floating point type
Returns
*this if successful
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
okay so literally every one of these extractors parses your input using the stream's current locale โ specifically the num_get facet. that's the whole vibe, no cap. ๐
๐ operator>> (int) โ integer arithmetic extractor
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(int& __n)
Integer arithmetic extractors. bestie these are the moment โจ
Parameters
__nโ a variable of builtin integral type ๐ซถ
Returns
*thisif successful ๐
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (manipulators) โ ios_base &(*__pf)(ios_base &) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
Interface for manipulators. manipulators like std::ws and std::dec use these functions in constructs such as std::cin >> std::ws. wanna know more? go peek at the iomanip header, iykyk ๐
๐ฆ operator>> (long) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐ธ
Returns
*thisif successful โญ
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (long double) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long double& __f)
Floating point arithmetic extractors. yes girl, floats get their own little corner ๐
Parameters
__fโ a variable of builtin floating point type ๐
Returns
*thisif successful ๐
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (long long) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long long& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type โจ
Returns
*thisif successful ๐ฅ
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (short)
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(short& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐ซถ
Returns
*thisif successful ๐
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
References โ std::ios_base::badbit, std::ios_base::failbit, std::num_get< _CharT, _InIter >::get(), std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet(). ๐
๐ operator>> (unsigned int) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐ง
Returns
*thisif successful ๐
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (unsigned long) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐ธ
Returns
*thisif successful โญ
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ฆ operator>> (unsigned long long) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐
Returns
*thisif successful โจ
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐
operator>> (unsigned short) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type ๐
Returns
*thisif successful ๐ฅ
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ operator>> (void*) โ [inline]
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(void*& __p)
Basic arithmetic extractors. pointers get to play too, periodt ๐
Parameters
__pโ a variable of pointer type ๐ซถ
Returns
*thisif successful ๐
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
๐ฅ peek โ looking ahead in the stream
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>::int_type
std::basic_istream<_CharT, _Traits>::peek(void)
Looking ahead in the stream. the main character move of glancing before you commit ๐ซ
Returns
- the next character, or
eof(). ๐ญ
so like โ after constructing the sentry object, if good() is false, it returns traits::eof(). otherwise it reads but does not extract the next input character. peek don't snatch, bestie ๐
References โ _M_gcount, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdbuf(). ๐
๐ธ std::ios_base::precision() โ [inline], [nodiscard], [inherited]
streamsize std::ios_base::precision() const
Flags access.
Returns
- the precision to generate on certain output operations. โจ
โ ๏ธ be careful if you try to give a definition of precision here โ see DR 189. no cap, this one's a trap ๐ฉ
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<(). ๐
๐ง std::ios_base::precision(streamsize __prec) โ [inline], [inherited]
streamsize std::ios_base::precision(streamsize __prec)
Changing flags.
Parameters
__precโ the new precision value ๐
Returns
- the previous value of
precision(). โญ
๐ putback โ unextracting a single character
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::putback(char_type __c)
Unextracting a single character. it's giving "jk bestie, put it back" ๐
Parameters
__cโ the character to push back into the input stream ๐ซถ
Returns
*this๐
if rdbuf() is not null, it calls rdbuf()->sputbackc(c).
if rdbuf() is null, or if sputbackc() fails, it sets badbit in the error state. ๐ญ
๐ Note โ this function first clearseofbit. since no characters are extracted, the next call togcount()will return0, as required by DR 60. iconic behaviour honestly โจ
References โ _M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_streambuf< _CharT, _Traits >::sputbackc(). ๐
Referenced by std::operator<<(). ๐
๐ฆ std::ios_base::pword(int __ix) โ [inline], [inherited]
void*& std::ios_base::pword(int __ix)
Access to void pointer array.
Parameters
__ixโ index into the array ๐ธ
Returns
- a reference to a
void*associated with the index. โญ
so the pword function provides access to an array of pointers that can be used for any purpose. the array grows as required to hold the supplied index, and all pointers in the array are initialized to 0. ๐ซถ
๐ฉ the implementation reserves several indices. you should use xalloc to obtain an index that is safe to use. also note that since the array can grow dynamically, it is not safe to hold onto the reference. lowkey important, don't skip this one bestie ๐ญ
๐ std::basic_ios< _CharT, _Traits >::rdbuf() const โ [inline], [nodiscard], [inherited]
template<typename _CharT, typename _Traits>
basic_streambuf<_CharT, _Traits>*
std::basic_ios<_CharT, _Traits>::rdbuf() const
Accessing the underlying buffer.
Returns
- the current stream buffer. ๐
this does not change the state of the stream. no drama, no side effects โจ
Referenced by clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), imbue(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_ostream< _CharT, _Traits >::tellp(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws(). that's a LOT of friends, main character energy fr fr ๐
๐
๐ std::basic_ios< _CharT, _Traits >::rdbuf(basic_streambuf< _CharT, _Traits > * __sb) โ [inherited]
template<typename _CharT, typename _Traits>
basic_streambuf<_CharT, _Traits>*
std::basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
Changing the underlying buffer.
Parameters
__sbโ the new stream buffer ๐ธ
Returns
- the previous stream buffer. โญ
it associates a new buffer with the current stream, and clears the error state. โจ
๐ okay so, due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. as a result, you must use explicit qualifications to access this function via any derived class. for example:
std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>
References โ clear(). ๐
๐ง std::basic_ios< _CharT, _Traits >::rdstate() const โ [inline], [nodiscard], [inherited]
template<typename _CharT, typename _Traits>
iostate
std::basic_ios<_CharT, _Traits>::rdstate() const
Returns the error state of the stream buffer.
Returns
- a bit pattern (well, isn't everything?) ๐ญ๐
see std::ios_base::iostate for the possible bit values. most users will call one of the interpreting wrappers, e.g., good(). ๐ซถ
Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget(). ๐
๐ read โ extraction without delimiters
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
Extraction without delimiters. it takes exactly what you ask for, no negotiating โจ
Parameters
__sโ a character array ๐ธ__nโ maximum number of characters to store ๐
Returns
*this๐
okay so back to read โ when the stream state is good(), it pulls characters out and drops them into __s until one of these things happens:
__ncharacters have been stored- the input sequence hits end-of-file, in which case the error state gets set to
failbit|eofbit.
Note bestie ๐ this function is not overloaded onsigned charandunsigned char.
References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().
streamsize std::basic_istream<_CharT, _Traits>::readsome(char_type * __s, streamsize __n)
Extraction until the buffer is exhausted, but no more. likeโฆ it takes what's there and dips, no begging for more ๐
Parameters
__sโ a character array.__nโ maximum number of characters to store.
Returns
The number of characters extracted.
So it extracts characters and stores them into __s, and how many it takes depends on how many characters are left sitting in the streambuf's buffer, rdbuf()->in_avail(), which we're calling A here:
- if
A == -1, it setseofbitand extracts no characters - if
A == 0, it extracts no characters - if
A > 0, it extractsmin(A,n)
The goal is literally to empty the current buffer and not request anything more from the external input sequence that the streambuf is controlling. main character energy of just taking what's already on the table ๐
References: _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::goodbit, std::min(), std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().
void std::ios_base::register_callback(event_callback __fn, int __index)
[inherited] โ Add the callback __fn with parameter __index. ๐
Parameters
__fnโ the function to add.__indexโ the integer to pass to the function when invoked.
So it registers a function as an event callback, with an integer parameter that gets passed to the function whenever it's invoked. Multiple copies of the same function are allowed, no gatekeeping here. And if there are multiple callbacks, they get invoked in the order they were registered โ first come, first served, periodt. โจ
basic_istream< _CharT, _Traits > & std::basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
Changing the current read position. glow-up for your cursor position ๐ซ
Parameters
__offโ a file offset object.__dirโ the direction in which to seek.
Returns
*this
If fail() is not true, it calls rdbuf()->pubseekoff(__off,__dir). And if that function fails, it sets failbit. rude but okay ๐ญ
Note โ this function first 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(), std::basic_ios< _CharT, _Traits >::setstate().
basic_istream< _CharT, _Traits > & std::basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
Changing the current read position. the other flavor of the same vibe ๐ธ
Parameters
__posโ a file position object.
Returns
*this
If fail() is not true, it calls rdbuf()->pubseekpos(__pos). If that function fails, it sets failbit. same energy as before, different arg ๐ซถ
Note โ this function first 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(), std::basic_ios< _CharT, _Traits >::setstate().
fmtflags std::ios_base::setf(fmtflags __fmtfl)
[inline], [inherited] โ Setting new format flags. ๐ฅ
Parameters
__fmtflโ additional flags to set.
Returns
The previous format control flags.
This one sets additional flags in format control, and here's the tea: flags that were previously set stay set. no clearing, no erasing, we're just adding ๐
Referenced by std::__detail::operator>>().
fmtflags std::ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
[inline], [inherited] โ Setting new format flags. โจ
Parameters
__fmtflโ additional flags to set.__maskโ the flags mask for__fmtfl.
Returns
The previous format control flags.
This version clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield. it's giving precision, it's giving control ๐
void std::basic_ios<_CharT, _Traits>::setstate(iostate __state)
[inline], [inherited] โ Sets additional flags in the error state. ๐
Parameters
__stateโ the additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), std::ws().
ngl that's a whole friend group showing up to the party ๐
int std::basic_istream<_CharT, _Traits>::sync(void)
Synchronizing the stream buffer. ๐ฆ
Returns
0 on success, -1 on failure
Here's the flow, bestie:
- If
rdbuf()is a null pointer, it returns-1. - Otherwise, it calls
rdbuf()->pubsync(), and if that returns-1, it setsbadbitand returns-1. - Otherwise, it returns
0.
Note โ this function does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount().
References: std::ios_base::badbit, std::ios_base::goodbit, std::basic_streambuf< _CharT, _Traits >::pubsync(), std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::setstate().
bool std::ios_base::sync_with_stdio(bool __sync = true)
[static], [inherited] โ Interaction with the standard C I/O objects. ๐
Parameters
__syncโ whether to synchronize or not.
Returns
True if the standard streams were previously synchronized.
The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary
iykyk โ this is the one people turn off for speed and then act surprised ๐ญ
basic_istream< _CharT, _Traits >::pos_type std::basic_istream<_CharT, _Traits>::tellg(void)
Getting the current read position. โญ
Returns
A file position object.
If fail() is not false, it returns pos_type(-1) to indicate failure. Otherwise it returns rdbuf()->pubseekoff(0,cur,in).
Note โ this function does not count the number of characters extracted, if any, and therefore does not affect the next call 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, std::basic_ios< _CharT, _Traits >::rdbuf().
basic_ostream< _CharT, _Traits > * std::basic_ios<_CharT, _Traits>::tie() const
[inline], [nodiscard], [inherited] โ Fetches the current tied stream. ๐ซถ
Returns
A pointer to the tied stream, or NULL if the stream is not tied.
So a stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream gets flushed first. For example, std::cin is tied to std::cout. iconic behavior, honestly ๐
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and copyfmt().
basic_ostream< _CharT, _Traits > * std::basic_ios<_CharT, _Traits>::tie(basic_ostream< _CharT, _Traits > * __tiestr)
[inline], [inherited] โ Ties this stream to an output stream. ๐
Parameters
__tiestrโ the output stream.
Returns
The previously tied output stream, or NULL if the stream was not tied.
This sets up a new tie; see tie() for more. besties are linked now ๐
basic_istream< _CharT, _Traits > & std::basic_istream<_CharT, _Traits>::unget(void)
Unextracting the previous character. the rewind, the take-backsies ๐ซ
Returns
*this
Here's what goes down:
- If
rdbuf()is not null, it 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(), std::basic_streambuf< _CharT, _Traits >::sungetc().
Referenced by std::__detail::operator>>().
void std::ios_base::unsetf(fmtflags __mask)
[inline], [inherited] โ Clearing format flags. ๐ง
Parameters
__maskโ the flags to unset.
This function clears __mask in the format flags. the un-slay of flags, if you will ๐
char_type std::basic_ios<_CharT, _Traits>::widen(char __c) const
[inline], [inherited] โ Widens characters. ๐ธ
Parameters
__cโ the character to widen.
Returns
The widened character.
It maps a character of char to a character of char_type. And it returns the result of
std::use_facet<ctype<char_type> >(getloc()).widen(c)
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html ๐
widen the vibe, bestie, the locale said so โจ
Referenced by std::endl(), std::basic_ios< char_type, traits_type >::fill(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::getline(), std::getline(), std::getline(), std::operator<<(), std::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::tr2::operator>>().
streamsize std::ios_base::width () const โ [inline], [nodiscard], [inherited]
okay bestie this one is literally called Flags access and it's giving "how wide should my output be" energy โจ
Returns
The minimum field width to generate on output operations. ๐
And just so we're clear โ minimum field width means the number of characters. That's the unit. Characters. Not vibes. ๐ญ
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
streamsize std::ios_base::width (streamsize __wide) โ [inline], [inherited]
This is the Changing flags twin, the setter of the duo ๐
Parameters
__wideโ the new width value, bestie. That's the whole assignment.
Returns
The previous value of width(). Not the new one. The old one. She remembers where you were before she changed. iconic behavior tbh ๐
int std::ios_base::xalloc () โ [static], [inherited]
Access to unique indices โจ and honestly this one is so underrated.
Returns
An integer different from all previous calls. every. single. time. no cap ๐ซถ
This function returns a unique integer every time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. ๐ฆ
The implementation maintains a static variable that is incremented and returned on each invocation. And xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays. slay, no notes ๐
๐ Member Data Documentation ๐
okay these are the actual data members, the little variables living inside these classes. buckle up, there are a LOT of them and they're all lowkey important ๐
template<typename _CharT, typename _Traits> streamsize std::basic_istream< _CharT, _Traits >::_M_gcount โ [protected]
The number of characters extracted in the previous unformatted function; see gcount(). that's it, that's the whole job, she counts ๐งฎ
Referenced by get(), get(), get(), get(), ignore(), ignore(), ignore(), peek(), putback(), read(), readsome(), and unget().
const fmtflags std::ios_base::adjustfield โ [static], [inherited]
A mask of left|right|internal. Useful for the 2-arg form of setf. a little trio of alignment besties ๐
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().
const openmode std::ios_base::app โ [static], [inherited]
Seek to end before each write. every write. she checks. she does not skip. ๐
Referenced by std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
const openmode std::ios_base::ate โ [static], [inherited]
Open and seek to end immediately after opening. note the difference from app bestie โ ate does it once at open time, app does it before every single write. not the same girl, don't mix them up ๐
Referenced by std::basic_filebuf< _CharT, _Traits >::open().
const iostate std::ios_base::badbit โ [static], [inherited]
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). this is the bad one, the serious one, the "we are cooked" bit ๐ญ
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, char_traits< _CharT > >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
const fmtflags std::ios_base::basefield โ [static], [inherited]
A mask of dec|oct|hex. Useful for the 2-arg form of setf. your number base squad, choose your fighter ๐ข
Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().
const seekdir std::ios_base::beg โ [static], [inherited]
Request a seek relative to the beginning of the stream. back to the start, babes ๐ฌ
Referenced by std::basic_filebuf< _CharT, _Traits >::seekpos().
const openmode std::ios_base::binary โ [static], [inherited]
Perform input and output in binary mode (as opposed to text mode). And then the manpage hits you with this:
This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
no fr bestie, go read that doc before you assume anything. the manpage is literally telling you your mental model is wrong ๐
Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().
const fmtflags std::ios_base::boolalpha โ [static], [inherited]
Insert/extract bool in alphabetic rather than numeric format. so you get true/false instead of 1/0. she's fancy like that โจ
Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().
const seekdir std::ios_base::cur โ [static], [inherited]
Request a seek relative to the current position within the sequence. right where you are, right now, no moving ๐ซถ
Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
const fmtflags std::ios_base::dec โ [static], [inherited]
Converts integer input or generates integer output in decimal base. the default one, the base-10 girlie, the one everyone uses without thinking ๐ธ
Referenced by std::dec(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
const seekdir std::ios_base::end โ [static], [inherited]
Request a seek relative to the current end of the sequence. run to the back of the line ๐โโ๏ธ
Referenced by std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().
const iostate std::ios_base::eofbit โ [static], [inherited]
Indicates that an input operation reached the end of an input sequence. that's all folks, nothing left to read ๐
Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, char_traits< _CharT > >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, char_traits< _CharT > >::seekg(), std::basic_istream< _CharT, _Traits >::unget(), std::basic_istream< _CharT, char_traits< _CharT > >::unget(), and std::ws().
const iostate std::ios_base::failbit โ [static], [inherited]
Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. not the catastrophic one like badbit, but still a fail, still a whole mood ๐
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), and std::basic_ostream< _CharT, _Traits >::seekp().
const fmtflags std::ios_base::fixed โ [static], [inherited]
Generate floating-point output in fixed-point notation. no exponents, just decimals, very demure ๐
Referenced by std::fixed(), and std::hexfloat().
const fmtflags std::ios_base::floatfield โ [static], [inherited]
A mask of scientific|fixed. Useful for the 2-arg form of setf. the float formatting duo ๐
Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
const iostate std::ios_base::goodbit โ [static], [inherited]
Indicates all is well. ๐โจ zero problems, zero drama, the stream is thriving, she ate and left no crumbs ๐
okay we're still going, bestie โ the data members keep coming and they do not stop ๐
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
const fmtflags std::ios_base::hex[static],[inherited]โ Converts integer input or generates integer output in hexadecimal base. Hex girl summer ๐ฅ
Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::hex().
const openmode std::ios_base::in[static],[inherited]โ Open for input. Default forifstreamandfstream. Come on in, the water's fine ๐
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_stringbuf< char >::basic_stringbuf(), std::basic_stringstream< char >::basic_stringstream(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_streambuf< char_type, traits_type >::pubseekoff(), std::basic_streambuf< char_type, traits_type >::pubseekpos(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_streambuf< char_type, traits_type >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< char >::seekoff(), std::basic_streambuf< char_type, traits_type >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::seekpos(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< char >::showmanyc(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().
const fmtflags std::ios_base::internal[static],[inherited]โ Adds fill characters at a designated internal point in certain generated output, or identical torightif no such point is designated. Internal affairs ๐
Referenced by std::internal().
const fmtflags std::ios_base::left[static],[inherited]โ Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.). Left, left, left, right, left ๐ถ
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::left(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
const fmtflags std::ios_base::oct[static],[inherited]โ Converts integer input or generates integer output in octal base. Oct-oct-oct ๐
Referenced by std::oct().
const openmode std::ios_base::out[static],[inherited]โ Open for output. Default forofstreamandfstream. Out and about ๐
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringbuf< char >::basic_stringbuf(), std::basic_stringstream< char >::basic_stringstream(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_streambuf< char_type, traits_type >::pubseekoff(), std::basic_streambuf< char_type, traits_type >::pubseekpos(), std::basic_streambuf< char_type, traits_type >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< char >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_streambuf< char_type, traits_type >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
const fmtflags std::ios_base::right[static],[inherited]โ Adds fill characters on the left (initial positions) of certain generated output. (I.e., the thing you print is flush right.). Right on ๐
Referenced by std::right().
const fmtflags std::ios_base::scientific[static],[inherited]โ Generates floating-point output in scientific notation. Science slay ๐งช
Referenced by std::hexfloat(), and std::scientific().
const fmtflags std::ios_base::showbase[static],[inherited]โ Generates a prefix indicating the numeric base of generated integer output. Show it off ๐
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::noshowbase(), and std::showbase().
const fmtflags std::ios_base::showpoint[static],[inherited]โ Generates a decimal-point character unconditionally in generated floating-point output. Point made โจ
Referenced by std::noshowpoint(), and std::showpoint().
const fmtflags std::ios_base::showpos[static],[inherited]โ Generates a + sign in non-negative generated numeric output. Positivity only โ๏ธ
Referenced by std::noshowpos(), and std::showpos().
const fmtflags std::ios_base::skipws[static],[inherited]โ Skips leading white space before certain input operations. Space? Don't know her ๐ซ
Referenced by std::noskipws(), std::__detail::operator>>(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, and std::skipws().
const openmode std::ios_base::trunc[static],[inherited]โ Truncate an existing stream when opening. Default forofstream. Cut it off โ๏ธconst fmtflags std::ios_base::unitbuf[static],[inherited]โ Flushes output after each output operation. Flush it out ๐ง
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().
const fmtflags std::ios_base::uppercase[static],[inherited]โ Replaces certain lowercase letters with their uppercase equivalents in generated output. LOUDER ๐ข
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::nouppercase(), and std::uppercase().
Author ๐
Generated automatically by Doxygen for libstdc++ from the source code. No cap, that's literally what it says.
And that's a wrap on std::basic_istream< _CharT, _Traits >, bestie. The footer says libstdc++ and the manpage title std::basic..., _Traits >(3). No date shown, but we're timeless anyway. Byeee ๐
โจ
๐ฆ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms