STD::BASIC_ISTRINGSTREAM(3)
๐ NAME ๐
okay so bestie, welcome to the manual page for std::basic_istringstream< _CharT, _Traits, _Alloc >(3) โ it's giving Library Functions Manual energy, and it's literally all about Controlling input for std::string. no cap.
โจ SYNOPSIS โจ
#include <sstream>
Inherits std::basic_istream< _CharT, _Traits >.
๐ธ Public Types ๐ธ
typedef ctype< _CharT > __ctype_typeโ a typedef, iconic.typedef basic_ios< _CharT, _Traits > __ios_typeโ another typedef moment.typedef basic_istream< char_type, traits_type > __istream_typeโ yes, typedef.typedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typeโ typedef, slay.typedef basic_streambuf< _CharT, _Traits > __streambuf_typeโ typedef vibes.typedef basic_string< _CharT, _Traits, _Alloc > __string_typeโ the string type, periodt.typedef basic_stringbuf< _CharT, _Traits, _Alloc > __stringbuf_typeโ the stringbuf type.typedef _Alloc allocator_typeโ allocator type, as promised.typedef _CharT char_typeโ char type.enum event { erase_event, imbue_event, copyfmt_event }โ The set of events that may be passed to an event callback.typedef void(* event_callback) (event __e, ios_base &__b, int __i)โ The type of an event callback function.typedef _Ios_Fmtflags fmtflagsโ This is a bitmask type.typedef traits_type::int_type int_typeโ int_type, okay.typedef _Ios_Iostate iostateโ This is a bitmask type.typedef traits_type::off_type off_typeโ off_type, yes.typedef _Ios_Openmode openmodeโ This is a bitmask type.typedef traits_type::pos_type pos_typeโ pos_type, fr fr.typedef _Ios_Seekdir seekdirโ This is an enumerated type.typedef _Traits traits_typeโ traits type, lowkey essential.typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typeโ yep, another typedef, we love to see it.
๐ Public Member Functions ๐
basic_istringstream ()โ Default constructor starts with an empty string buffer.basic_istringstream (__string_type &&__str, ios_base::openmode __mode=ios_base::in)โ rvalue string constructor, with__modedefaulting toios_base::in.basic_istringstream (basic_istringstream &&__rhs)โ move constructor, main character energy.basic_istringstream (const __string_type &__str, ios_base::openmode __mode=ios_base::in)โ Starts with an existing string buffer.basic_istringstream (const basic_istringstream &)=deleteโ copy constructor is deleted, bestie. not available.template<typename _SAlloc> basic_istringstream (const basic_string< _CharT, _Traits, _SAlloc > &__str, const allocator_type &__a)โ templated constructor with allocator.template<typename _SAlloc> basic_istringstream (const basic_string< _CharT, _Traits, _SAlloc > &__str, ios_base::openmode __mode, const allocator_type &__a)โ templated constructor with mode and allocator.template<typename _SAlloc> basic_istringstream (const basic_string< _CharT, _Traits, _SAlloc > &__str, ios_base::openmode __mode=ios_base::in)โ templated constructor, mode defaults toios_base::in.basic_istringstream (ios_base::openmode __mode)โ Starts with an empty string buffer.basic_istringstream (ios_base::openmode __mode, const allocator_type &__a)โ openmode plus allocator constructor.~basic_istringstream ()โ The destructor does nothing. iconic, honestly.template<typename _ValueT> basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)โ internal extract helper.const locale & _M_getloc () constโ Locale access.void _M_setstate (iostate __state)โ internal state setter.bool bad () constโ Fast error checking.void clear (iostate __state=goodbit)โ [Re]sets the error state.basic_ios & copyfmt (const basic_ios &__rhs)โ Copies fields of__rhsinto this.bool eof () constโ Fast error checking.iostate exceptions () constโ Throwing exceptions on errors.void exceptions (iostate __except)โ Throwing exceptions on errors.bool fail () constโ Fast error checking.char_type fill () constโ Retrieves the empty character.char_type fill (char_type __ch)โ Sets a new empty character.fmtflags flags () constโ Access to format flags.fmtflags flags (fmtflags __fmtfl)โ Setting new format flags all at once.streamsize gcount () constโ Character counting.basic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)โ explicit specialization declaration, defined insrc/istream.cc.basic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)โ Explicit specialization declarations, defined insrc/istream.cc.locale getloc () constโ Locale access.bool good () constโ Fast error checking.basic_istream< wchar_t > & ignore (streamsize __n)โ ignore overload, wchar_t flavor.basic_istream< char > & ignore (streamsize __n)โ ignore overload, char flavor.basic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)โ ignore with delimiter, wchar_t flavor.basic_istream< char > & ignore (streamsize __n, int_type __delim)โ ignore with delimiter, char flavor.locale imbue (const locale &__loc)โ Moves to a new locale.long & iword (int __ix)โ Access to integer array.char narrow (char_type __c, char __dfault) constโ Squeezes characters.basic_istringstream & operator= (basic_istringstream &&__rhs)โ move assignment.basic_istringstream & operator= (const basic_istringstream &)=deleteโ copy assignment is deleted.__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 (basic_streambuf< _CharT, _Traits > *__sb)โ Changing the underlying buffer.__stringbuf_type * rdbuf () constโ Accessing 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.__string_type str () &&โ rvalue str access.__string_type str () const &โ Copying out the string buffer.void str (__string_type &&__s)โ Setting a new buffer.void str (const __string_type &__s)โ Setting a new buffer.template<__allocator_like _SAlloc> basic_string< _CharT, _Traits, _SAlloc > str (const _SAlloc &__sa) constโ allocator-aware str getter.template<__allocator_like _SAlloc> void str (const basic_string< _CharT, _Traits, _SAlloc > &__s)โ allocator-aware str setter.void swap (basic_istringstream &__rhs)โ swap, bestie.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.basic_string_view< char_type, traits_type > view () const noexceptโ view, no cap.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, no cap ๐__istream_type & get (char_type &__c)โ also simple extraction, but into a char ref ๐__istream_type & get (char_type *__s, streamsize __n, char_type __delim)โ simple multiple-character extraction, with a delimiter bestie โจ__istream_type & get (char_type *__s, streamsize __n)โ same thing, no delimiter specified ๐ฆ__istream_type & get (__streambuf_type &__sb, char_type __delim)โ extraction straight into another streambuf, delimited ๐ธ__istream_type & get (__streambuf_type &__sb)โ extraction into another streambuf, plain and simple ๐__istream_type & getline (char_type *__s, streamsize __n, char_type __delim)โ string extraction, delimiter included ๐ฅ__istream_type & getline (char_type *__s, streamsize __n)โ string extraction, default delim energy โญ__istream_type & ignore (streamsize __n, int_type __delim)โ discarding characters, so iconic ๐๏ธ__istream_type & ignore (streamsize __n)โ simple extraction vibes ๐__istream_type & ignore ()โ simple extraction vibes, again ๐ซถ__istream_type & ignore (streamsize __n, char __delim)โ simple extraction vibes, char edition ๐int_type peek ()โ looking ahead in the stream, no touching, just looking ๐__istream_type & read (char_type *__s, streamsize __n)โ extraction without delimiters, she does NOT stop for anyone ๐streamsize readsome (char_type *__s, streamsize __n)โ extraction until the buffer is exhausted, but no more. boundaries, queen ๐__istream_type & putback (char_type __c)โ unextracting a single character, rewinding like it never happened ๐__istream_type & unget ()โ unextracting the previous character, reverse uno ๐งint sync ()โ synchronizing the stream buffer โกpos_type tellg ()โ getting the current read position, where are we bestie ๐__istream_type & seekg (pos_type)โ changing the current read position ๐__istream_type & seekg (off_type, ios_base::seekdir)โ changing the current read position, but with a direction ๐operator bool () constโ the quick-and-easy status check โจbool operator! () constโ the quick-and-easy status check, but the hater version ๐
๐ 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โ yep, it's there ๐ซงstatic const fmtflags adjustfieldโ a mask ofleft|right|internal. Useful for the 2-arg form ofsetf. ๐ฏstatic const openmode appโ seek to end before each write ๐โโ๏ธstatic const openmode ateโ open and seek to end immediately after opening ๐static const iostate badbitโ indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file) ๐ญstatic const fmtflags basefieldโ a mask ofdec|oct|hex. Useful for the 2-arg form ofsetf. ๐งฎstatic const seekdir begโ request a seek relative to the beginning of the stream ๐static const openmode binaryโ perform input and output in binary mode (as opposed to text mode). This is probably not what you think it is; seehttps://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binaryโ ๏ธstatic const fmtflags boolalphaโ insert/extractboolin alphabetic rather than numeric format ๐คstatic const seekdir curโ request a seek relative to the current position within the sequence ๐static const fmtflags decโ converts integer input or generates integer output in decimal base ๐static const seekdir endโ request a seek relative to the current end of the sequence ๐static const iostate eofbitโ indicates that an input operation reached the end of an input sequence ๐static const iostate failbitโ indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters ๐static const fmtflags fixedโ generate floating-point output in fixed-point notation ๐งทstatic const fmtflags floatfieldโ a mask ofscientific|fixed. Useful for the 2-arg form ofsetf. ๐static const iostate goodbitโ indicates all is well ๐ฅฐstatic const fmtflags hexโ converts integer input or generates integer output in hexadecimal base ๐กstatic const openmode inโ open for input. Default forifstreamandfstream. ๐ฅstatic const fmtflags internalโ adds fill characters at a designated internal point in certain generated output, or identical torightif no such point is designated ๐งฉstatic const fmtflags leftโ adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.). โฌ ๏ธstatic const fmtflags octโ converts integer input or generates integer output in octal base ๐static const openmode outโ open for output. Default forofstreamandfstream. ๐คstatic const fmtflags rightโ adds fill characters on the left (initial positions) of certain generated output. (I.e., the thing you print is flush right.). โก๏ธstatic const fmtflags scientificโ generates floating-point output in scientific notation ๐ฌstatic const fmtflags showbaseโ generates a prefix indicating the numeric base of generated integer output ๐ท๏ธstatic const fmtflags showpointโ generates a decimal-point character unconditionally in generated floating-point output ๐static const fmtflags showposโ generates a+sign in non-negative generated numeric output โstatic const fmtflags skipwsโ skips leading white space before certain input operations ๐ซฅstatic const openmode truncโ truncate an existing stream when opening. Default forofstream. โ๏ธstatic const fmtflags unitbufโ flushes output after each output operation ๐ฝstatic const fmtflags uppercaseโ replaces certain lowercase letters with their uppercase equivalents in generated output ๐
๐ก๏ธ Protected Types ๐ก๏ธ
enum { _S_local_word_size }โ the local word size, protected bestie ๐ซฃ
๐งธ Protected Member Functions ๐งธ
void _M_cache_locale (const locale &__loc)๐๏ธvoid _M_call_callbacks (event __ev) throw ()๐void _M_dispose_callbacks (void) throw ()๐๏ธtemplate<typename _ValueT> __istream_type & _M_extract (_ValueT &__v)๐งฒ_Words & _M_grow_words (int __index, bool __iword)๐ฑvoid _M_init () throw ()๐void _M_move (ios_base &) noexcept๐void _M_swap (ios_base &__rhs) noexcept๐void init (basic_streambuf< _CharT, _Traits > *__sb)โ all setup is performed here ๐ ๏ธvoid move (basic_ios &&__rhs)๐void move (basic_ios &__rhs)๐โโ๏ธvoid set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)๐void swap (basic_ios &__rhs) noexcept๐void swap (basic_istream &__rhs)๐
๐ Protected Attributes ๐
_Callback_list * _M_callbacks๐const __ctype_type * _M_ctype๐คiostate _M_exception๐จchar_type _M_fill๐งดbool _M_fill_initโfmtflags _M_flags๐ฉstreamsize _M_gcount๐ขlocale _M_ios_locale๐_Words _M_local_word [_S_local_word_size]๐const __num_get_type * _M_num_get๐ฝconst __num_put_type * _M_num_put๐ผstreamsize _M_precision๐ฏbasic_streambuf< _CharT, _Traits > * _M_streambuf๐งบiostate _M_streambuf_state๐basic_ostream< _CharT, _Traits > * _M_tie๐ฝstreamsize _M_width๐_Words * _M_word๐int _M_word_size๐ข_Words _M_word_zero0๏ธโฃ
๐ธ Detailed Description ๐ธ
template<typename _CharT, typename _Traits, typename _Alloc>
class std::basic_istringstream< _CharT, _Traits, _Alloc >
"Controlling input for std::string." periodt ๐
โจ Template Parameters โจ
_CharTโ type of character stream ๐ค_Traitsโ traits for character type, defaults tochar_traits<_CharT>. ๐งฌ_Allocโ allocator type, defaults toallocator<_CharT>. ๐งบ
This class supports reading from objects of type std::basic_string, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb. no cap ๐ซถ
๐ 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 ๐ซฃโจ
typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]
The type of an event callback function ๐ฃ
Parameters
__eโ one of the members of theeventenum. ๐ช__bโ reference to theios_baseobject. ๐ฆ__iโ the integer provided when the callback was registered. ๐ข
Event callbacks are user defined functions that get called during several ios_base and basic_ios functions, specifically imbue(), copyfmt(), and ~ios(). the way they just show up ๐ญ
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(). iconic behavior tbh ๐
๐ธ Constructor & Destructor Documentation ๐ธ
bestie it's constructors time, let's GO ๐
โจ basic_istringstream() โ the default one, no cap โจ
template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream () [inline]
Default constructor, and it kicks things off with a totally empty string buffer. It initializes sb using in, and passes &sb to the base class initializer. Does not allocate any buffer. ๐
That's a lie. We initialize the base class with NULL, because the string class does its own memory management. ๐ญ iconic honestly
โจ basic_istringstream(ios_base::openmode __mode) โ pick your mode โจ
template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream
(ios_base::openmode __mode) [inline], [explicit]
Also starts with an empty string buffer, but you get to say how it behaves ๐ฆ
Parameters
__modeโ whether the buffer can read, or write, or both.
ios_base::in is automatically included in __mode. Periodt, you don't get a say.
Initializes sb using __mode|in, and passes &sb to the base class initializer. Does not allocate any buffer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management. ๐ same energy as before
โจ basic_istringstream(const __string_type & __str, ios_base::openmode __mode = ios_base::in) โ bring your own string โจ
template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream
(const __string_type & __str, ios_base::openmode __mode = ios_base::in)
[inline], [explicit]
Now THIS one starts with an existing string buffer. main character energy ๐
Parameters
__strโ a string to copy as a starting buffer.__modeโ whether the buffer can read, or write, or both.
ios_base::in is automatically included in mode. (yes, mode โ that's what the docs say, we don't make the rules ๐)
Initializes sb using str and mode|in, and passes &sb to the base class initializer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management. ๐ the trio of lies is complete
โจ ~basic_istringstream() โ the destructor, she does nothing โจ
template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_istringstream< _CharT, _Traits, _Alloc
>::~basic_istringstream () [inline]
The destructor does nothing. Zero. Nada. The buffer is deallocated by the stringbuf object, not the formatting stream. she's just here for the vibes ๐
๐ Member Function Documentation ๐
okay this is the big one, buckle up bestie, we're going through every single function fr fr ๐ง
๐ std::ios_base::_M_getloc() โ locale access ๐
const locale & std::ios_base::_M_getloc () const [inline], [inherited]
Returns
- A reference to the current locale.
Like getloc above, but returns a reference instead of generating a copy. lowkey efficient of her โจ
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()
๐ bad() โ fast error checking ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::bad () const [inline], [nodiscard], [inherited]
Fast error checking, she's quick ๐จ
Returns
Trueif thebadbitis set.
Note that other iostate flags may also be set. so like, don't assume it's only badbit, ok? ๐
Referenced by: std::basic_ostream< _CharT, _Traits >::sentry::sentry().
๐ clear(iostate __state = goodbit) โ [Re]sets the error state ๐
template<typename _CharT, typename _Traits> void std::basic_ios< _CharT,
_Traits >::clear (iostate __state = goodbit) [inherited]
[Re]sets the error state. the brackets are doing a lot of work there and I respect it ๐
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. (if that's you, you're valid ๐ซถ)
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()
๐ copyfmt() โ copies fields of __rhs into this ๐
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 "becoming your friend" ๐ธ
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(). the order MATTERS bestie, don't skip steps ๐ฅ
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() โ fast error checking again ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::eof () const [inline], [nodiscard], [inherited]
Fast error checking. โก
Returns
Trueif theeofbitis set.
Note that other iostate flags may also be set. same disclaimer, every time, iconic consistency ๐
๐ exceptions() const โ the getter ๐
template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT,
_Traits >::exceptions () const [inline], [nodiscard], [inherited]
Throwing exceptions on errors. ๐ค
Returns
- The current exceptions mask.
This changes nothing in the stream. See the one-argument version of exceptions(iostate) for the meaning of the return value.
Referenced by: clear(), and copyfmt().
๐ exceptions(iostate __except) โ the setter, and she's dramatic ๐
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);
}
bestie run this and watch the chaos unfold, it's giving cinema ๐ญ
๐ fail() โ fast error checking, the remix ๐
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::fail () const [inline], [nodiscard], [inherited]
Fast error checking. โกโก
Returns
Trueif either thebadbitor thefailbitis set.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set. yes we know, we've heard it before, but it's true every time ๐ซถ
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() const โ retrieves the empty character ๐
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. the humble space, doing so much for us ๐
Referenced by: copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
๐ fill(char_type __ch) โ sets a new empty character ๐
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. math girlies rise, Q<P is a whole inequality ๐งฎโจ
๐ std::ios_base::flags() const โ access to format flags ๐
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>>
๐ std::ios_base::flags(fmtflags __fmtfl) โ setting new format flags all at once ๐
fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once. go big or go home ๐ฅ
Parameters
__fmtflโ the new flags to set.
Returns
- The previous format control flags.
This function overwrites all the format flags with __fmtfl. not a merge, an overwrite. she does not share the spotlight ๐
๐ gcount() โ character counting ๐
template<typename _CharT, typename _Traits> streamsize std::basic_istream<
_CharT, _Traits >::gcount () const [inline], [inherited]
Character counting. ๐ข
Returns
- The number of characters extracted by the previous unformatted input function dispatched for this stream.
๐ get(void) โ simple extraction ๐
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits
>::int_type std::basic_istream< _CharT, _Traits >::get (void )
[inherited]
Simple extraction. keep it simple, bestie โจ
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(__streambuf_type & __sb) โ extraction into another streambuf ๐
template<typename _CharT, typename _Traits> __istream_type &
std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb)
[inline], [inherited]
Extraction into another streambuf. ๐ฆ
Parameters
__sbโ a streambuf in which to store data.
Returns
*this
Returns get(__sb,widen('\n')). that's it, that's the whole function, she's a shortcut queen ๐
๐ get(__streambuf_type & __sb, char_type __delim) โ extraction into another streambuf, now 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) [inherited]
Extraction into another streambuf, but this time you get to say when to stop ๐
Parameters
__sbโ a streambuf in which to store data.__delimโ a "stop" character.
Characters get extracted and yeeted into __sb until one of these things pops off:
- the input sequence hits EOF ๐
- inserting into the output buffer fails (and in that case, the character that would have been inserted is not extracted โ she stays right where she is, bestie)
- the next character equals
__delim(and nope, that character is not extracted either) - an exception occurs (and in this case it is caught, so we move on gracefully ๐ )
If zero characters get 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 little guy. That's it. โจ
Parameters
__cโ the character in which to store data. That's where she goes.
Returns
*this
Tries to extract a character and store it in __c. If none are available, it sets failbit and returns traits::eof(). Iconic sad-girl behavior, but that's the spec.
Note โ This function is not overloaded onsigned charandunsigned char. Noted, no cap.
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. Glow-up from the single-char version. ๐
Parameters
__sโ pointer to an array.__nโ maximum number of characters to store ins.
Returns
*this
Returns get(__s,__n,widen('\n')). She's literally just forwarding the call, and honestly? Relatable.
๐ฆ template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type * __s, streamsize __n, char_type __delim) [inherited]
Simple multiple-character extraction, but make it deluxe.
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. Periodt.
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. The main character of every while (std::getline(...)) loop ever. ๐
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 bestie, the real implementation lives in a .cc file. The header was just the trailer.
โจ 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. Let's get into it.
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. The order is not a vibe, it's a requirement. ๐ซถ
- 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. The [nodiscard] is watching you โ do not ignore her return value.
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 function. ๐
Returns
True if no error flags are set.
A wrapper around rdstate.
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. Ignore her, she's busy ignoring characters.
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::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. Same energy, new argument. โจ
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::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. Yes, the docs really do repeat this three times. We're keeping it fr fr.
Returns
A character, or eof().
Tries to extract a character. If none are available, 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 ignore. ๐๏ธ
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. She's doing extra credit and still following the syllabus. Queen behavior. ๐
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. Locale glow-up. ๐
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. Don't even try it bestie, she's locked. ๐
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().
That list? Everyone pulls up to init. It's giving main character energy for a protected function, honestly.
๐ long & std::ios_base::iword (int __ix) [inline], [inherited]
Access to integer array. Your own lil' scratch space.
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 clutch it, bestie, she may move.
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. Compression but for character types. ๐ซถ
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 ๐
operator bool () โ the vibe check for your stream ๐
template<typename _CharT, typename _Traits>
std::basic_ios<_CharT, _Traits>::operator bool () const
[inline], [explicit], [nodiscard], [inherited]
Bestie, this is the quick-and-easy status check. It's literally the "are you okay??" text you send at 2am. It lets you write stuff like if (!a_stream) ... and while (a_stream) ... โ no cap. โจ
operator! () โ the other vibe check ๐ฆ
template<typename _CharT, typename _Traits>
bool std::basic_ios<_CharT, _Traits>::operator! () const
[inline], [nodiscard], [inherited]
Again: the quick-and-easy status check. Same energy, opposite sign. Lets you write if (!a_stream) ... and while (a_stream) .... That's it, that's the whole thing. ๐
๐ operator>> overloads โ the extractor era
operator>> (__ios_type &(*__pf)(__ios_type &)) โ manipulator interface ๐ง
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*__pf)(__ios_type&))
[inline], [inherited]
It's the interface for manipulators. Manipulators like std::ws and std::dec use these functions in constructs like std::cin >> std::ws. Want the lore? Go look at the iomanip header. ๐
operator>> (__istream_type &(*__pf)(__istream_type &)) โ manipulator interface, the sequel ๐ธ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*__pf)(__istream_type&))
[inline], [inherited]
Interface for manipulators. Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header. ๐
operator>> (__streambuf_type *__sb) โ 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. Yes bestie, into a whole other streambuf, it's giving multitasking. ๐ญ
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__sbisNULL, the stream will setfailbitin its error state. Not the vibe. ๐
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 &__n) โ integer arithmetic extractors ๐ฅ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(bool& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. Periodt. โจ
operator>> (double &__f) โ floating point arithmetic extractors ๐ฆ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(double& __f)
[inline], [inherited]
Floating point arithmetic extractors.
Parameters
__fโ a variable of builtin floating point type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (float &__f) โ floating point arithmetic extractors (yes, again) ๐
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(float& __f)
[inline], [inherited]
Floating point arithmetic extractors.
Parameters
__fโ a variable of builtin floating point type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (int &__n) โ integer arithmetic extractors ๐
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(int& __n)
[inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (ios_base &(*__pf)(ios_base &)) โ manipulator interface again ๐ง
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
[inline], [inherited]
Interface for manipulators. Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header. ๐
operator>> (long &__n) โ integer arithmetic extractors ๐ธ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (long double &__f) โ floating point arithmetic extractors โจ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long double& __f)
[inline], [inherited]
Floating point arithmetic extractors.
Parameters
__fโ a variable of builtin floating point type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐ฆ
operator>> (long long &__n) โ integer arithmetic extractors ๐ฅ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(long long& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (short &__n) โ integer arithmetic extractors ๐
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(short& __n)
[inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
References std::ios_base::badbit, std::ios_base::failbit, std::num_get<_CharT, _InIter>::get(), std::ios_base::goodbit, std::basic_ios<_CharT, _Traits>::setstate(), and std::use_facet(). ๐
operator>> (unsigned int &__n) โ integer arithmetic extractors ๐
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐ง
operator>> (unsigned long &__n) โ integer arithmetic extractors ๐ธ
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. โจ
operator>> (unsigned long long &__n) โ integer arithmetic extractors ๐
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
operator>> (unsigned short &__n) โ integer arithmetic extractors ๐
template<typename _CharT, typename _Traits>
__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
[inline], [inherited]
Integer arithmetic extractors.
Parameters
__nโ a variable of builtin integral type.
Returns
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐ฆ
operator>> (void *&__p) โ basic arithmetic extractors ๐
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
*thisif successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data. ๐
peek (void ) โ 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. Like peeking at the group chat before you type, bestie. ๐
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 () const โ flags access โจ
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. ๐
Referenced by std::basic_ios<_CharT, _Traits>::copyfmt(), and std::chrono::operator<<().
precision (streamsize __prec) โ changing flags ๐
streamsize std::ios_base::precision(streamsize __prec)
[inline], [inherited]
Changing flags.
Parameters
__precโ the new precision value.
Returns
- The previous value of
precision().
putback (char_type __c) โ unextracting a single character ๐ญ
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::putback(char_type __c)
[inherited]
Unextracting a single character. The un-eat. The anti-snack. Put it back where you found it. ๐
Parameters
__cโ the character to push back into the input stream.
Returns
*this.
If rdbuf() is not null, calls rdbuf()->sputbackc(c).
If rdbuf() is null or if sputbackc() fails, sets badbit in the error state.
Note โ This function first clearseofbit. Since no characters are extracted, the next call togcount()will return0, as required by DR 60. Fr fr, zero. ๐ซถ
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 (int __ix) โ access to void pointer array ๐
void*& std::ios_base::pword(int __ix)
[inline], [inherited]
Access to void pointer array.
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. Iconic, honestly. ๐
okay bestie, quick heads-up before we keep rolling ๐ โ the implementation reserves several indices for itself, so if you want an index that's actually safe to use, you gotta grab one with xalloc. And also, real talk: since that array can grow dynamically, it is not safe to hold onto the reference. let it go, bestie. ๐
๐ rdbuf โ the setter version
template<typename _CharT, typename _Traits> basic_streambuf<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb) [inherited]
Changing the underlying buffer. glowy new buffer, who dis โจ
Parameters
__sbโ the new stream buffer.
Returns
- the previous stream buffer.
So basically: it associates a new buffer with the current stream, and clears the error state. two birds, one slay.
Now here's the messy part, and I need you to sit with me: due to historical accidents which the LWG refuses to correct ๐ญ, the I/O library suffers from a design error โ this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. Like so:
std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>
References clear().
๐ rdbuf() โ the getter version (istringstream edition)
template<typename _CharT, typename _Traits, typename _Alloc> __stringbuf_type* std::basic_istringstream<_CharT, _Traits, _Alloc>::rdbuf() const [inline], [nodiscard]
Accessing the underlying buffer.
Returns
- the current
basic_stringbufbuffer.
Notably, this one hides both signatures of std::basic_ios::rdbuf(). the audacity, honestly ๐ซฃ
๐ง rdstate
template<typename _CharT, typename _Traits> iostate std::basic_ios<_CharT, _Traits>::rdstate() const [inline], [nodiscard], [inherited]
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 just call one of the interpreting wrappers instead, 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
template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) [inherited]
Extraction without delimiters. no commas, no whitespace-skipping, just vibes and characters.
Parameters
__sโ a character array.__nโ maximum number of characters to store.
Returns
*this
If the stream state is good(), it extracts characters and stores them into __s until one of these happens:
__ncharacters are stored- the input sequence reaches end-of-file, in which case the error state is set to
failbit|eofbit.
Note: this function is not overloaded onsigned charandunsigned char. just so you know, bestie ๐ซถ
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
template<typename _CharT, typename _Traits> streamsize std::basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) [inherited]
Extraction until the buffer is exhausted, but no more. it's giving "eat what's on your plate, don't go back for seconds" ๐
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 here is to empty the current buffer, and to not request any more from the external input sequence controlled by the streambuf.
References _M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::goodbit, std::min(), std::basic_ios<_CharT, _Traits>::rdbuf(), and std::basic_ios<_CharT, _Traits>::setstate().
๐ register_callback
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.
Registers a function as an event callback with an integer parameter that gets passed to the function when it's invoked. Multiple copies of the function are allowed. And if there are multiple callbacks? They're invoked in the order they were registered. first come, first served, periodt. ๐
โช seekg (the offset + direction one)
template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) [inherited]
Changing the current read position. time travel, but for your stream ๐ฆ
Parameters
__offโ a file offset object.__dirโ the direction in which to seek.
Returns
*this
If fail() is not true, it calls rdbuf()->pubseekoff(__off,__dir). If that function fails, it sets failbit.
Note: this function first clearseofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call togcount().
References std::ios_base::badbit, std::basic_ios<_CharT, _Traits>::clear(), std::ios_base::eofbit, std::basic_ios<_CharT, _Traits>::fail(), std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::in, std::basic_ios<_CharT, _Traits>::rdbuf(), std::basic_ios<_CharT, _Traits>::rdstate(), and std::basic_ios<_CharT, _Traits>::setstate().
โฉ seekg (the position one)
template<typename _CharT, typename _Traits> basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::seekg(pos_type __pos) [inherited]
Changing the current read position.
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: again, 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().
๐๏ธ setf (one argument)
fmtflags std::ios_base::setf(fmtflags __fmtfl) [inline], [inherited]
Setting new format flags.
Parameters
__fmtflโ additional flags to set.
Returns
- the previous format control flags.
This function sets additional flags in format control. Flags that were previously set remain set โ nobody's getting un-set here.
Referenced by std::__detail::operator>>().
๐๏ธ๐๏ธ setf (with a mask)
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 forfmtfl.
Returns
- the previous format control flags.
This function clears mask in the format flags, then sets fmtfl & mask. One example mask is ios_base::adjustfield. ๐
๐จ setstate
template<typename _CharT, typename _Traits> void std::basic_ios<_CharT, _Traits>::setstate(iostate __state) [inline], [inherited]
Sets additional flags in the error state.
Parameters
__stateโ the additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
Referenced by โ okay bestie, buckle up, this list is long ๐ซ :
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()
and yes, a few of those appear twice. that's the page, not me ๐ญ keeping it 100% faithful.
๐ str() โ copying it out
template<typename _CharT, typename _Traits, typename _Alloc> __string_type std::basic_istringstream<_CharT, _Traits, _Alloc>::str() const & [inline], [nodiscard]
Copying out the string buffer.
Returns
rdbuf()->str()
๐ str(const __string_type&) โ setting a new one
template<typename _CharT, typename _Traits, typename _Alloc> void std::basic_istringstream<_CharT, _Traits, _Alloc>::str(const __string_type& __s) [inline]
Setting a new buffer.
Parameters
__sโ the string to use as a new sequence.
Calls rdbuf()->str(s).
๐ sync
template<typename _CharT, typename _Traits> int std::basic_istream<_CharT, _Traits>::sync(void) [inherited]
Synchronizing the stream buffer. get everyone on the same page, bestie ๐ค
Returns
0on success,-1on failure
If rdbuf() is a null pointer, it returns -1.
Otherwise, it calls rdbuf()->pubsync(), and if that returns -1, it sets badbit and returns -1.
Otherwise, it 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
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
trueif the standard streams were previously synchronized.
Important caveat, so listen up: 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
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits >::pos_type
std::basic_istream< _CharT, _Traits >::tellg (void )
[inherited]
Okay bestie, this one is literally just "where am I rn?" for reading. ๐ It hands you the current read position.
Returns: a file position object. Simple as that.
But the deets: if fail() is not false, it returns pos_type(-1) to say "nope, failed ๐ญ". Otherwise it returns rdbuf()->pubseekoff(0,cur,in).
Note ๐ซถ โ this function does not count how many characters got extracted (if any), so it does not affect the next call togcount(). And โ plot twist โ at variance withputback,ungetandseekg,eofbitis not cleared first. She stays where she is, periodt. ๐
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().
tie (the const one)
template<typename _CharT, typename _Traits> 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 isn't tied.
So here's the vibe: a stream can be tied (a.k.a. synchronized) to a second output stream. The moment this stream does any I/O, the tied stream gets flushed first. The iconic example: std::cin is tied to std::cout. ๐ธ
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and copyfmt().
tie (the setter one)
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. Gluing them together fr fr. ๐ซถ
Parameters:
__tiestrโ the output stream.
Returns: the previously tied output stream, or NULL if the stream wasn't tied.
This sets up a brand new tie; peep tie() for more. ๐
unget
template<typename _CharT, typename _Traits> basic_istream< _CharT, _Traits > &
std::basic_istream< _CharT, _Traits >::unget (void )
[inherited]
Unextracting the previous character. Yes, you read that right โ she's giving it back. ๐ญ
Returns: *this
If rdbuf() is not null, it calls rdbuf()->sungetc(c).
If rdbuf() is null or if sungetc() fails, it sets badbit in the error state. ๐
Note ๐ง โ this function first clearseofbit. And since no characters are extracted, the next call togcount()will return0, as required by DR 60. No cap.
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>>().
std::ios_base::unsetf
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.
widen
template<typename _CharT, typename _Traits> char_type
std::basic_ios< _CharT, _Traits >::widen (char __c) const
[inline], [inherited]
Widens characters. She's stretching the lil guy out. ๐
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)
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.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
width (setter)
streamsize std::ios_base::width (streamsize __wide)
[inline], [inherited]
Changing flags. ๐ง
Parameters:
__wideโ the new width value.
Returns: the previous value of width().
xalloc
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 single time it's called. It can be used for any purpose, but it's primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict.
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. Periodt. ๐
๐ 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. ๐
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. ๐โโ๏ธ๐จ
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). ๐ This is the "everything is on fire" bit, bestie.
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().
basefield
const fmtflags std::ios_base::basefield
[static], [inherited]
A mask of dec|oct|hex. Useful for the 2-arg form of setf. ๐ข
Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().
beg
const seekdir std::ios_base::beg
[static], [inherited]
Request a seek relative to the beginning of the stream. โช
Referenced by std::basic_filebuf< _CharT, _Traits >::seekpos().
binary
const openmode std::ios_base::binary
[static], [inherited]
Perform input and output in binary mode (as opposed to text mode). ๐ฆ
Heads up bestie!! ๐จ This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().
boolalpha
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, iconic honestly. โจ
Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().
cur
const seekdir std::ios_base::cur
[static], [inherited]
Request a seek relative to the current position within the sequence. ๐
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().
dec
const fmtflags std::ios_base::dec
[static], [inherited]
Converts integer input or generates integer output in decimal base. ๐
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>>.
end
const seekdir std::ios_base::end
[static], [inherited]
Request a seek relative to the current end of the sequence. โฉ
Referenced by std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().
eofbit
const iostate std::ios_base::eofbit
[static], [inherited]
Indicates that an input operation reached the end of an input sequence. ๐ That's all she wrote.
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().
okay bestie, final stretch of the inherited ios_base constants โ the static data members that run the whole stream flag situation. no cap, they're the foundation of everything. let's go ๐
โจ
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.- 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()(ร2),std::time_get< _CharT, _InIter >::get(),std::basic_fstream< char >::open()(ร2),std::basic_ifstream< char >::open()(ร2),std::basic_ofstream< char >::open()(ร2),std::operator<<(),std::basic_iostream< char_type, traits_type >::operator>>(),std::basic_istream< _CharT, _Traits >::operator>>()(ร2),std::operator>>(),std::basic_istream< _CharT, _Traits >::read(),std::basic_istream< _CharT, _Traits >::seekg()(ร2),std::basic_ostream< _CharT, _Traits >::seekp()(ร2).
- Referenced by:
const fmtflags std::ios_base::fixed [static], [inherited]โ Generate floating-point output in fixed-point notation.- Referenced by:
std::fixed(), andstd::hexfloat().
- Referenced by:
const fmtflags std::ios_base::floatfield [static], [inherited]โ A mask ofscientific|fixed. Useful for the 2-arg form ofsetf.- Referenced by:
std::defaultfloat(),std::fixed(),std::hexfloat(), andstd::scientific().
- Referenced by:
const iostate std::ios_base::goodbit [static], [inherited]โ Indicates all is well.- Referenced by:
std::basic_istream< _CharT, _Traits >::sentry::sentry(),std::num_get< _CharT, _InIter >::do_get(),std::time_get< _CharT, _InIter >::do_get(),std::time_get< _CharT, _InIter >::do_get_monthname(),std::time_get< _CharT, _InIter >::do_get_weekday(),std::time_get< _CharT, _InIter >::do_get_year(),std::basic_ostream< _CharT, _Traits >::flush(),std::basic_iostream< char_type, traits_type >::get(),std::basic_istream< _CharT, _Traits >::get()(ร4),std::time_get< _CharT, _InIter >::get(),std::basic_istream< _CharT, _Traits >::ignore()(ร3),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>>()(ร2),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()(ร2),std::basic_istream< _CharT, _Traits >::sync(),std::basic_istream< _CharT, _Traits >::unget(), andstd::ws().
- Referenced by:
const fmtflags std::ios_base::hex [static], [inherited]โ Converts integer input or generates integer output in hexadecimal base.- Referenced by:
std::num_get< _CharT, _InIter >::do_get(),std::num_put< _CharT, _OutIter >::do_put(), andstd::hex().
- Referenced by:
const openmode std::ios_base::in [static], [inherited]โ Open for input. Default forifstreamandfstream.- Referenced by:
std::basic_fstream< char >::basic_fstream()(ร3),std::basic_ifstream< char >::basic_ifstream()(ร3),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()(ร3),std::basic_ifstream< char >::open()(ร3),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()(ร2),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(), andstd::basic_filebuf< _CharT, _Traits >::xsgetn().
- Referenced by:
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.- Referenced by:
std::internal().
- Referenced by:
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.).- Referenced by:
std::num_put< _CharT, _OutIter >::do_put(),std::left(), andstd::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
- Referenced by:
const fmtflags std::ios_base::oct [static], [inherited]โ Converts integer input or generates integer output in octal base.- Referenced by:
std::oct().
- Referenced by:
const openmode std::ios_base::out [static], [inherited]โ Open for output. Default forofstreamandfstream.- Referenced by:
std::basic_fstream< char >::basic_fstream()(ร3),std::basic_ofstream< char >::basic_ofstream()(ร3),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()(ร3),std::basic_ofstream< char >::open()(ร3),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()(ร2),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(), andstd::basic_filebuf< _CharT, _Traits >::xsputn().
- Referenced by:
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.).- Referenced by:
std::right().
- Referenced by:
const fmtflags std::ios_base::scientific [static], [inherited]โ Generates floating-point output in scientific notation.- Referenced by:
std::hexfloat(), andstd::scientific().
- Referenced by:
const fmtflags std::ios_base::showbase [static], [inherited]โ Generates a prefix indicating the numeric base of generated integer output.- Referenced by:
std::num_put< _CharT, _OutIter >::do_put(),std::noshowbase(), andstd::showbase().
- Referenced by:
const fmtflags std::ios_base::showpoint [static], [inherited]โ Generates a decimal-point character unconditionally in generated floating-point output.- Referenced by:
std::noshowpoint(), andstd::showpoint().
- Referenced by:
const fmtflags std::ios_base::showpos [static], [inherited]โ Generates a+sign in non-negative generated numeric output.- Referenced by:
std::noshowpos(), andstd::showpos().
- Referenced by:
const fmtflags std::ios_base::skipws [static], [inherited]โ Skips leading white space before certain input operations.- Referenced by:
std::noskipws(),std::__detail::operator>>(),std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, andstd::skipws().
- Referenced by:
const openmode std::ios_base::trunc [static], [inherited]โ Truncate an existing stream when opening. Default forofstream.const fmtflags std::ios_base::unitbuf [static], [inherited]โ Flushes output after each output operation.- Referenced by:
std::basic_ostream< _CharT, _Traits >::sentry::~sentry(),std::nounitbuf(), andstd::unitbuf().
- Referenced by:
const fmtflags std::ios_base::uppercase [static], [inherited]โ Replaces certain lowercase letters with their uppercase equivalents in generated output.- Referenced by:
std::num_put< _CharT, _OutIter >::do_put(),std::nouppercase(), andstd::uppercase().
- Referenced by:
๐ Author
Generated automatically by Doxygen for libstdc++ from the source code. iconic, honestly.
That's the whole page, bestie. The footer says source/version libstdc++ and the title is std::basic...s, _Alloc >(3) โ the date isn't in this bit, so I'm not making one up. periodt. ๐
๐ฆ
๐ฆ 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