STD::ISTRINGSTREAM(3cxx)
π NAME π
std::basic_istringstream< _CharT, _Traits, _Alloc > β literally just controlling input for std::string, bestie. That's the whole vibe. It's the <sstream> girlie that lets you read out of a string like it's a stream. Iconic behavior, no cap. (And yes, we're in the 3cxx section, section 3, C++ library, iykyk π)
β¨ SYNOPSIS β¨
#include <sstream>
So first things first, she inherits std::basic_istream< _CharT, _Traits >. Like, that's her mother. That's where all the stream energy comes from. π
πΈ Public Types πΈ
Okay so she has a LOT of typedefs and honestly they're all serving a purpose, so let's go through every single one because we don't skip:
typedef ctype< _CharT > __ctype_typeβ the ctype vibetypedef basic_ios< _CharT, _Traits > __ios_typeβ the ios vibetypedef basic_istream< char_type, traits_type > __istream_typeβ the istream vibetypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typeβ the num_get vibetypedef basic_streambuf< _CharT, _Traits > __streambuf_typeβ the streambuf vibetypedef basic_string< _CharT, _Traits, _Alloc > __string_typeβ the string vibe (main character tbh)typedef basic_stringbuf< _CharT, _Traits, _Alloc > __stringbuf_typeβ the stringbuf vibetypedef _Alloc allocator_typeβ the allocator, she allocates πtypedef _CharT char_typeβ the char typeenum event { erase_event, imbue_event, copyfmt_event }β ngl this one's important: 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, fr frtypedef _Ios_Fmtflags fmtflagsβ this is a bitmask type, okay bestie write that downtypedef traits_type::int_type int_typeβ the int typetypedef _Ios_Iostate iostateβ this is a bitmask type tootypedef traits_type::off_type off_typeβ the off typetypedef _Ios_Openmode openmodeβ yup, also a bitmask typetypedef traits_type::pos_type pos_typeβ the pos typetypedef _Ios_Seekdir seekdirβ and this one is an enumerated type (different!!)typedef _Traits traits_typeβ the traits, she has traitstypedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typeβ the num_put vibe
π Public Member Functions π
This is the big one. Buckle up. There are so many and every single one is getting her moment:
basic_istringstream ()β Default constructor starts with an empty string buffer π«Άbasic_istringstream (basic_istringstream &&__rhs)β the move constructor, she movesbasic_istringstream (const __string_type &__str, ios_base::openmode __mode=ios_base::in)β starts with an existing string buffer, so you're not starting from scratch, love that for youbasic_istringstream (const basic_istringstream &)=deleteβ copying is deleted, she said no βbasic_istringstream (ios_base::openmode __mode)β starts with an empty string buffer, but with a mode this time~basic_istringstream ()β the destructor does nothing. That's it. That's the whole job. πtemplate<typename _ValueT > basic_istream< _CharT, _Traits > & _M_extract (_ValueT &__v)β internal extract helperconst locale & _M_getloc () constβ locale access π₯void _M_setstate (iostate __state)β internal state setterbool bad () constβ fast error checking β‘void clear (iostate __state=goodbit)β [re]sets the error statebasic_ios & copyfmt (const basic_ios &__rhs)β copies fields of__rhsinto thisbool eof () constβ fast error checkingiostate exceptions () constβ throwing exceptions on errorsvoid exceptions (iostate __except)β throwing exceptions on errors (yes, the setter version)bool fail () constβ fast error checkingchar_type fill () constβ retrieves the empty characterchar_type fill (char_type __ch)β sets a new empty characterfmtflags flags () constβ access to format flagsfmtflags flags (fmtflags __fmtfl)β setting new format flags all at once, she's efficientstreamsize gcount () constβ character countingbasic_istream< char > & getline (char_type *__s, streamsize __n, char_type __delim)β explicit specialization declarations, defined insrc/istream.ccbasic_istream< wchar_t > & getline (char_type *__s, streamsize __n, char_type __delim)β the wchar_t twin of the abovelocale getloc () constβ locale accessbool good () constβ fast error checkingbasic_istream< char > & ignore (streamsize __n)β the char specializationbasic_istream< wchar_t > & ignore (streamsize __n)β the wchar_t specializationbasic_istream< char > & ignore (streamsize __n, int_type __delim)β char version with a delimiterbasic_istream< wchar_t > & ignore (streamsize __n, int_type __delim)β wchar_t version with a delimiterlocale imbue (const locale &__loc)β moves to a new localelong & iword (int __ix)β access to integer arraychar narrow (char_type __c, char __dfault) constβ squeezes characters πbasic_istringstream & operator= (basic_istringstream &&__rhs)β move assignment, she assignsbasic_istringstream & operator= (const basic_istringstream &)=deleteβ copy assignment deleted, again, no π__istream_type & operator>> (__streambuf_type *__sb)β extracting into another streambuf__istream_type & operator>> (void *&__p)β basic arithmetic extractorsstreamsize precision () constβ flags accessstreamsize precision (streamsize __prec)β changing flagsvoid *& pword (int __ix)β access to void pointer array__stringbuf_type * rdbuf () constβ accessing the underlying bufferbasic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb)β changing the underlying bufferiostate rdstate () constβ returns the error state of the stream buffervoid register_callback (event_callback __fn, int __index)β add the callback__fnwith parameter__indexfmtflags setf (fmtflags __fmtfl)β setting new format flagsfmtflags setf (fmtflags __fmtfl, fmtflags __mask)β setting new format flags, now with a maskvoid setstate (iostate __state)β sets additional flags in the error state__string_type str () constβ copying out the string buffervoid str (const __string_type &__s)β setting a new buffervoid swap (basic_istringstream &__rhs)β swap herbasic_ostream< _CharT, _Traits > * tie () constβ fetches the current tied streambasic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr)β ties this stream to an output stream πvoid unsetf (fmtflags __mask)β clearing format flagsbasic_string_view< char_type, traits_type > view () const noexceptβ she gives you a view, no capchar_type widen (char __c) constβ widens charactersstreamsize width () constβ flags accessstreamsize width (streamsize __wide)β changing flags
And then the manipulator interfaces, which are nested right under there:
__istream_type & operator>> (__istream_type &(*__pf)(__istream_type &))β interface for manipulators__istream_type & operator>> (__ios_type &(*__pf)(__ios_type &))β interface for manipulators__istream_type & operator>> (ios_base &(*__pf)(ios_base &))β interface for manipulators
π₯ Extractors π₯
Okay so all the operator>> functions (aka the formatted input functions, slay) have some common behavior and you NEED to know it:
Each one starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to false. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.
If the sentry status is good, the function tries to extract whatever data is appropriate for the type of the argument.
β οΈ 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. Like, pay attention to that one bestie, it's giving "read the fine print." π
Then, the actual extractors, all of them:
__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, all the unformatted input functions share some common behavior:
Each one starts by constructing a temporary object of type std::basic_istream::sentry with the second argument (noskipws) set to true (!! note it's true here, not false, that's the whole difference, don't get it twisted). 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().
β οΈ And again: 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.
The lineup, every last one:
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 extractionint_type peek ()β looking ahead in the stream π__istream_type & read (char_type *__s, streamsize __n)β extraction without delimitersstreamsize readsome (char_type *__s, streamsize __n)β extraction until the buffer is exhausted, but no more__istream_type & putback (char_type __c)β unextracting a single character__istream_type & unget ()β unextracting the previous characterint sync ()β synchronizing the stream bufferpos_type tellg ()β getting the current read position__istream_type & seekg (pos_type)β changing the current read position__istream_type & seekg (off_type, ios_base::seekdir)β changing the current read position, the seekdir wayoperator bool () constβ the quick-and-easy status checkbool operator! () constβ the quick-and-easy status check, but negated
π Static Public Member Functions π
static bool sync_with_stdio (bool __sync=true)β interaction with the standard C I/O objectsstatic int xalloc () throw ()β access to unique indices
β¨ Static Public Attributes β¨
okay bestie, this is the big pile of constants β flags, masks, and states you'll be slinging around. all of them live on the class, none of them are yours to change π
static const openmode __noreplaceβ no description given, it's just there being mysterious π«Ά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 (like 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. π¨ like, actually read that, bestie, it's giving trap.static const fmtflags boolalphaβ insert/extractboolin alphabetic rather than numeric format. sotrue/falseinstead of1/0β¨static const seekdir curβ request a seek relative to the current position within the sequence.static const fmtflags decβ converts integer input or generates integer output in decimal base.static const seekdir endβ request a seek relative to the current end of the sequence.static const iostate eofbitβ indicates that an input operation reached the end of an input sequence.static const iostate failbitβ indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. πstatic const fmtflags fixedβ generate floating-point output in fixed-point notation.static const fmtflags floatfieldβ a mask ofscientific|fixed. Useful for the 2-arg form ofsetf.static const iostate goodbitβ indicates all is well. π the dream, honestly.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. highkey clingy and we respect it.static const fmtflags uppercaseβ replaces certain lowercase letters with their uppercase equivalents in generated output.
π‘οΈ Protected Types π‘οΈ
enum { _S_local_word_size }β a little anonymous enum, minding its own business.
π§ Protected Member Functions π§
these are the internals, the backstage crew. you don't touch them, they don't touch you. π«Ά
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. literally all of it, bestie.void move (basic_ios &&__rhs)void move (basic_ios &__rhs)void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)void swap (basic_ios &__rhs) noexceptvoid swap (basic_istream &__rhs)
πΈ Protected Attributes πΈ
just... a whole lotta state, ngl. every one of these is a little vibe the stream is holding onto.
_Callback_list * _M_callbacksconst __ctype_type * _M_ctypeiostate _M_exceptionchar_type _M_fillbool _M_fill_initfmtflags _M_flagsstreamsize _M_gcountlocale _M_ios_locale_Words _M_local_word [_S_local_word_size]const __num_get_type * _M_num_getconst __num_put_type * _M_num_putstreamsize _M_precisionbasic_streambuf< _CharT, _Traits > * _M_streambufiostate _M_streambuf_statebasic_ostream< _CharT, _Traits > * _M_tiestreamsize _M_width_Words * _M_wordint _M_word_size_Words _M_word_zero
π Detailed Description π
template<typename _CharT, typename _Traits, typename _Alloc>
class std::basic_istringstream< _CharT, _Traits, _Alloc >
Controlling input for std::string. π that's the whole gig!
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. β¨ lowkey everything runs through sb.
π 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. π consider yourself warned.
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(). π
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(). π¦
π Constructor & Destructor Documentation π
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream () [inline]
Default constructor starts with an empty string buffer. 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. π not the docs gaslighting us, but okay, we love transparency.
References std::basic_ios< _CharT, _Traits >::init().
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream (ios_base::openmode __mode) [inline], [explicit]
Starts with an empty string buffer.
Parameters
__modeβ whether the buffer can read, or write, or both.
ios_base::in is automatically included in __mode.
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. π again!! iconic honesty though.
References std::basic_ios< _CharT, _Traits >::init().
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]
Starts with an existing string buffer. π«Ά this is the one where you hand it your actual string.
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.
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. β¨ third time's the charm.
References std::basic_ios< _CharT, _Traits >::init().
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_istringstream< _CharT, _Traits, _Alloc >::~basic_istringstream () [inline]
The destructor does nothing. The buffer is deallocated by the stringbuf object, not the formatting stream. π§ so chill. it literally does nothing and honestly? mood.
π Member Function Documentation π
const locale & std::ios_base::_M_getloc () const [inline], [inherited]
Locale access. π
Returns
A reference to the current locale.
Like getloc above, but returns a reference instead of generating a copy. no cap, saves you a copy. π₯
Referenced by: std::money_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::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() β like, the whole friend group is tagging this one, iykyk π
.
π©Ή bad() const
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [inherited]
Bestie, this is the fast error check β speedrun version.
Returns: true if the badbit is set. Heads up: other iostate flags may also be set, so donβt read this as βonly badbit is on.β
References: std::ios_base::badbit, and std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by: std::basic_ostream< _CharT, _Traits >::sentry::sentry().
π§Ό clear(iostate __state = goodbit)
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]
This one [re]sets the error state β like clearing the group chat after a dramatic read.
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.
Referenced by: std::basic_ios< _CharT, _Traits >::exceptions(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::__detail::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
π copyfmt(const basic_ios< _CharT, _Traits > & __rhs)
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 object. Itβs giving βbestie, let me borrow your whole aestheticβ β¨.
Parameters: __rhs β the source values for the copies.
Returns: reference to this object.
All fields of __rhs are copied into this object except that rdbuf() and rdstate() remain unchanged. All values in the pword and iword arrays are copied. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions().
References: std::__addressof(), std::basic_ios< _CharT, _Traits >::exceptions(), std::basic_ios< _CharT, _Traits >::fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), std::basic_ios< _CharT, _Traits >::tie(), std::tie(), and std::ios_base::width().
π eof() const
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [inherited]
Another fast error check β no cap.
Returns: true if the eofbit is set.
Remember: other iostate flags may also be set, bestie.
References: std::ios_base::eofbit, and std::basic_ios< _CharT, _Traits >::rdstate().
π¨ exceptions() const
template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [inherited]
Throwing exceptions on errors β the dramatic option, honestly.
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: std::basic_ios< _CharT, _Traits >::copyfmt().
π₯ exceptions(iostate __except)
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline], [inherited]
Throwing exceptions on errors β now with actual settings π
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. No waiting, no suspense.
Try running the following under GCC 3.1 or later:
#include <iostream>
#include <fstream>
#include <exception>
int main()
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
std::ifstream f ("/etc/motd");
std::cerr << "Setting badbit\n";
f.setstate (std::ios_base::badbit);
std::cerr << "Setting exception mask\n";
f.exceptions (std::ios_base::badbit);
}
References: std::basic_ios< _CharT, _Traits >::clear().
π fail() const
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [inherited]
Fast error checking, but make it either-or π.
Returns: true if either the badbit or the failbit is set.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.
References: std::ios_base::badbit, std::ios_base::failbit, and std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by: std::basic_ios< _CharT, _Traits >::operator bool(), std::basic_ios< _CharT, _Traits >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::regex_traits< _Ch_type >::value().
π fill() const
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [inherited]
Retrieves the empty character β the filler bestie of the stream world π«Ά.
Returns: the current fill character.
It defaults to a space (' ') in the current locale.
References: std::basic_ios< _CharT, _Traits >::widen().
Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), and std::basic_ios< _CharT, _Traits >::fill().
ποΈ fill(char_type __ch)
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill (char_type __ch) [inline], [inherited]
Sets a new empty character. New filler, same iconic role π .
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.
References: std::basic_ios< _CharT, _Traits >::fill().
π© flags() const
fmtflags std::ios_base::flags () const [inline], [inherited]
Access to format flags β the streamβs whole personality board π.
Returns: the format control flags for both input and output.
Referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::normal_distribution< double >::operator()(), std::operator<<(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::operator>>().
π οΈ flags(fmtflags __fmtfl)
fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once β full makeover, no patchwork π.
Parameters: __fmtfl β the new flags to set.
Returns: the previous format control flags.
This function overwrites all the format flags with __fmtfl.
π’ gcount() const
template<typename _CharT , typename _Traits > streamsize std::basic_istream< _CharT, _Traits >::gcount () const [inline], [inherited]
Character counting β the receipts for your last unformatted input moment π§Ύ.
Returns: the number of characters extracted by the previous unformatted input function dispatched for this stream.
References: std::basic_istream< _CharT, _Traits >::_M_gcount.
π get(void)
template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits >::int_type std::basic_istream< _CharT, _Traits >::get (void) [inherited]
Simple extraction β just one little character, bestie π₯Ί.
Returns: a character, or eof().
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by: std::basic_istream< _CharT, _Traits >::get(), and std::basic_istream< _CharT, _Traits >::get().
π« get(__streambuf_type & __sb)
template<typename _CharT , typename _Traits > __istream_type & std::basic_istream< _CharT, _Traits >::get (__streambuf_type & __sb) [inline], [inherited]
Extraction into another streambuf β passing the snack to a different container π±.
Parameters: __sb β a streambuf in which to store data.
Returns: *this
Returns get(__sb,widen('\n')).
References: std::basic_istream< _CharT, _Traits >::get(), and std::basic_ios< _CharT, _Traits >::widen().
π§Ί get(__streambuf_type & __sb, char_type __delim)
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 with a stop sign π.
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: std::basic_istream< _CharT, _Traits >::_M_gcount, and std::ios_base::goodbit.
π¦ get(char_type & __c)
template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type & __c) [inherited]
Simple extraction β one character, but this time it lands in __c π―.
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 on signed char and unsigned char.
References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
π§ get(char_type * __s, streamsize __n)
template<typename _CharT , typename _Traits > __istream_type & std::basic_istream< _CharT, _Traits >::get (char_type * __s, streamsize __n) [inline], [inherited]
Simple multiple-character extraction.
β¦okay so bestie, picking right back up with the parameter rundown for that overload π
__sβ pointer to an array. literally just a pointer, she's pointing at your char array π«Ά__nβ maximum number of characters to store in s. (yes, the original sayss, we don't question it β¨)
Returns β *this, as always, so you can chain. iconic behavior π
And what does it actually return? Glad you asked:
get(__s,__n,widen('\n'))
That's it. That's the whole vibe check. πΈ
References: std::basic_istream< _CharT, _Traits >::get(), and std::basic_ios< _CharT, _Traits >::widen().
π₯ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::get (char_type * __s, streamsize __n, char_type __delim) β inherited
Simple multiple-character extraction. like, multiple characters, all at once, no cap π
Parameters
__sβ pointer to an array.__nβ maximum number of characters to store in__s.__delimβ a 'stop' character. she's the one who says when to stop π
Returns β *this
So here's the tea β characters get extracted and stored into __s until one of these happens:
__n-1characters are stored- the input sequence reaches EOF
- the next character equals
__delim, in which case the character is not extracted (she stays in the stream, main character energy, refuses to leave π)
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. not me checking twice, she simply does not do that π
References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
β¨ template<typename _CharT , typename _Traits > __istream_type & std::basic_istream< _CharT, _Traits >::getline (char_type * __s, streamsize __n) β [inline], [inherited]
String extraction! we love a string extraction moment π
Parameters
__sβ a character array in which to store the data.__nβ maximum number of characters to extract.
Returns β *this
Returns:
getline(__s,__n,widen('\n'))
References: std::basic_istream< _CharT, _Traits >::getline(), and std::basic_ios< _CharT, _Traits >::widen().
π 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, now with a delimiter and everything π¦
Parameters
__sβ a character array in which to store the data.__nβ maximum number of characters to extract.__delimβ a 'stop' character.
Returns β *this
She extracts and stores characters into __s until one of the following happens. And listen β these criteria are required to be tested in the order listed here, so that an input line can exactly fill the __s array without setting failbit. it's giving precision, it's giving choreography π
- the input sequence reaches end-of-file, in which case
eofbitis set in the stream error state - the next character equals
__delim, in which case the character is extracted (and therefore counted ingcount()) but not stored __n-1characters are stored, in which casefailbitis set in the stream error state
If no characters are extracted, failbit is set. (An empty line of input should therefore not cause failbit to be set β she's handling it, bestie π)
In any case, a null character is stored in the next location in the array. always. every time. π
Referenced by std::basic_istream< _CharT, _Traits >::getline().
π basic_istream< char > & std::basic_istream< char >::getline (char_type * __s, streamsize __n, char_type __delim) β [inherited]
Explicit specialization declarations, defined in src/istream.cc. that's the whole thing. she's special (literally) β
πΈ locale std::ios_base::getloc () const β [inline], [inherited]
Locale access π₯
Returns β a copy of the current locale.
If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. iykyk π
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().
π¦ template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::good () const β [inline], [inherited]
Fast error checking β‘
Returns β True if no error flags are set.
A wrapper around rdstate. that's literally all she is and she's thriving π«Ά
References: std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().
π template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (void) β [inherited]
Simple extraction.
Returns β a character, or eof().
Tries to extract a character. If none are available, sets failbit and returns traits::eof(). she tried, okay π
References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sbumpc().
π template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n) β [inherited]
Simple extraction. again. but with __n this time π
Returns β a character, or eof().
Tries to extract a character. If none are available, sets failbit and returns traits::eof().
References: std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_streambuf< _CharT, _Traits >::sgetc().
π template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::ignore (streamsize __n, int_type __delim) β [inherited]
Discarding characters. bye bestie πποΈ
Parameters
__nβ number of characters to discard.__delimβ a 'stop' character.
Returns β *this
She extracts characters and throws them away until one of the following happens:
- if
__n != std::numeric_limits<int>::max(),__ncharacters are extracted - the input sequence reaches end-of-file
- the next character equals
__delim(in this case, the character is extracted); note that this condition will never occur if__delimequalstraits::eof()β like, ever. don't come for her π
NB: Provide three overloads, instead of the single function (with defaults) mandated by the Standard: this leads to a better performing implementation, while still conforming to the Standard. she's fast and legal, we stan π
π§ 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). teamwork makes the dream work π«Ά
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
References: std::ios_base::imbue().
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. no takebacks, no overrides, we're locked in π
Referenced by std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ios< _CharT, _Traits >::basic_ios(), std::basic_istream< _CharT, _Traits >::basic_istream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ostream< _CharT, _Traits >::basic_ostream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream(), std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream(), and std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream().
likeβ¦everybody calls her. she's the moment. π
π 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. free real estate, do whatever π
The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. like, she will move on you, no cap π
β 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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
π template<typename _CharT , typename _Traits > std::basic_ios< _CharT, _Traits >::operator bool () const β [inline], [explicit], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... β yes bestie, streams in your if, it's giving convenience π
References: std::basic_ios< _CharT, _Traits >::fail().
π
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::operator! () const β [inline], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ... β the ! version, because sometimes you just gotta negate β¨
References: std::basic_ios< _CharT, _Traits >::fail().
π¦ template<typename _CharT , typename _Traits > __istream_type & std::basic_istream< _CharT, _Traits >::operator>> (__ios_type &(*)(__ios_type &) __pf) β [inline], [inherited]
Interface for manipulators π§ Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header. she's the glue that makes >> do the cute stuff, obsessed π«Ά
π operator>> β the manipulator one (__istream_type &(*)(__istream_type &))
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(__istream_type &(*)(__istream_type &) __pf) [inline], [inherited]
Okay so this is the interface for manipulators β¨ Manipulators like std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more info, see the iomanip header. iykyk π
π¦ operator>> β extracting into another streambuf (__streambuf_type *__sb)
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits> &std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type *__sb) [inherited]
Extracting into another streambuf, bestie π
__sbβ a pointer to astreambuf
This one behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
If __sb is NULL, the stream will set failbit in its error state. Not it. π
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
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(bool &__n) [inline], [inherited]
Integer arithmetic extractors, bestie π«Ά
__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. periodt β¨
πΈ operator>> β double &__f
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(double &__f) [inline], [inherited]
Floating point arithmetic extractors π
__fβ a variable of builtin floating point type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π§ operator>> β float &__f
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(float &__f) [inline], [inherited]
Floating point arithmetic extractors, again, and yes she ate π
__fβ a variable of builtin floating point type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π₯ operator>> β int &__n
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits> &std::basic_istream<_CharT, _Traits>::operator>>(int &__n) [inherited]
Integer arithmetic extractors (note: no [inline] on this one, she's built different π).
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
β operator>> β the ios_base manipulator (ios_base &(*)(ios_base &))
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(ios_base &(*)(ios_base &) __pf) [inline], [inherited]
Interface for manipulators π Manipulators such as std::ws and std::dec use these functions in constructs like std::cin >> std::ws. For more information, see the iomanip header.
π operator>> β long &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(long &__n) [inline], [inherited]
Integer arithmetic extractors π«Ά
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π operator>> β long double &__f
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(long double &__f) [inline], [inherited]
Floating point arithmetic extractors β¨
__fβ a variable of builtin floating point type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π¦ operator>> β long long &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(long long &__n) [inline], [inherited]
Integer arithmetic extractors, big-number edition π
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
πΈ operator>> β short &__n
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits> &std::basic_istream<_CharT, _Traits>::operator>>(short &__n) [inherited]
Integer arithmetic extractors (also not [inline], ok werk π
)
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
References std::ios_base::badbit, std::ios_base::failbit, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::setstate().
π§ operator>> β unsigned int &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(unsigned int &__n) [inline], [inherited]
Integer arithmetic extractors, unsigned girlie era π
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π₯ operator>> β unsigned long &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(unsigned long &__n) [inline], [inherited]
Integer arithmetic extractors π
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
β operator>> β unsigned long long &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(unsigned long long &__n) [inline], [inherited]
Integer arithmetic extractors, the biggest unsigned one, main character energy π
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π operator>> β unsigned short &__n
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(unsigned short &__n) [inline], [inherited]
Integer arithmetic extractors π
__nβ a variable of builtin integral type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π operator>> β void *&__p
template<typename _CharT, typename _Traits>
__istream_type &std::basic_istream<_CharT, _Traits>::operator>>(void *&__p) [inline], [inherited]
Basic arithmetic extractors π«Ά
__pβ a variable of pointer type.
Returns *this if successful.
These functions use the stream's current locale (specifically, the num_get facet) to parse the input data.
π¦ peek β looking ahead in the stream
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::peek(void) [inherited]
Looking ahead in the stream, no cap β¨
- 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. Lowkey the politest function here π
References std::basic_istream< _CharT, _Traits >::_M_gcount.
πΈ std::ios_base::precision() const β flags access
streamsize std::ios_base::precision() const [inline], [inherited]
Flags access π
- Returns: the precision to generate on certain output operations.
Careful, bestie β οΈ Be careful if you try to give a definition of precision here; see DR 189.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().
π§ std::ios_base::precision(streamsize __prec) β changing flags
streamsize std::ios_base::precision(streamsize __prec) [inline], [inherited]
Changing flags β¨
__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) [inherited]
Unextracting a single character, iconic behaviour honestly π
__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. Rip. π
Note π This function first clearseofbit. Since no characters are extracted, the next call togcount()will return0, as required by DR 60.
References std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_streambuf< _CharT, _Traits >::sputbackc().
Referenced by std::operator<<().
β std::ios_base::pword β access to the void pointer array
void *&std::ios_base::pword(int __ix) [inline], [inherited]
Access to void pointer array π«Ά
__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.
Heads up π¨ 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. Do not keep the reference, bestie, it will betray you. π
π std::basic_istringstream::rdbuf() const β accessing the underlying buffer
template<typename _CharT, typename _Traits, typename _Alloc>
__stringbuf_type *std::basic_istringstream<_CharT, _Traits, _Alloc>::rdbuf() const [inline]
Accessing the underlying buffer β¨
- Returns: the current
basic_stringbufbuffer.
Fun fact: this hides both signatures of std::basic_ios::rdbuf(). Sneaky but slay π
π¦ std::basic_ios::rdbuf(basic_streambuf< _CharT, _Traits > *__sb) β changing the underlying buffer
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 π
__sbβ the new stream buffer.- Returns: the previous stream buffer.
Associates a new buffer with the current stream, and clears the error state. Fresh start energy πβ¨
...and this is where it gets messy, bestie π so buckle up.
okay so real talk: 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>
like... the vibes are immaculate but the design is not π
πΈ rdstate()
template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [inherited]
Returns the error state of the stream buffer. that's it, that's the function β¨
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< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::eof(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ios< _CharT, _Traits >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
π¦ 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 vibes-based stopping, no "ooh a space, guess I'll stop", just characters π
Parameters
__sβ A character array.__nβ Maximum number of characters to store.
Returns β *this
If the stream state is good(), extracts characters and stores them into __s until one of the following happens:
__ncharacters are stored- the input sequence reaches end-of-file, in which case the error state is set to
failbit|eofbit.
Note β This function is not overloaded onsigned charandunsigned char. not me getting caught out by that literally every time π
References std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
π 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. she's mindful, she doesn't overreach π
Parameters
__sβ A character array.__nβ Maximum number of characters to store.
Returns β The number of characters extracted.
Extracts characters and stores them into __s depending on the number of characters remaining in the streambuf's buffer, rdbuf()->in_avail(), called A here:
- if
A == -1, setseofbitand extracts no characters - if
A == 0, extracts no characters - if
A > 0, extractsmin(A,n)
The goal is to empty the current buffer, and to not request any more from the external input sequence controlled by the streambuf. she said "take what's here and don't go asking for more" and honestly? boundaries π§
References std::basic_istream< _CharT, _Traits >::_M_gcount, std::ios_base::badbit, std::ios_base::eofbit, std::ios_base::goodbit, std::min(), std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
π register_callback()
void std::ios_base::register_callback (event_callback __fn, int __index) [inherited]
Add the callback __fn with parameter __index. putting your girl on the list β¨
Parameters
__fnβ The function to add.__indexβ The integer to pass to the function when invoked.
Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered. first come, first served, no cutting the line π«Ά
π seekg() β the offset 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. we're teleporting, bestie π¦
Parameters
__offβ A file offset object.__dirβ The direction in which to seek.
Returns β *this
If fail() is not true, calls rdbuf()->pubseekoff(__off,__dir). If that function fails, sets failbit.
Note β This function first clearseofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call togcount().
References std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::in, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), and std::basic_ios< _CharT, _Traits >::setstate().
β 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. same energy, different args π«
Parameters
__posβ A file position object.
Returns β *this
If fail() is not true, calls rdbuf()->pubseekpos(__pos). If that function fails, sets failbit.
Note β This function first clearseofbit. It does not count the number of characters extracted, if any, and therefore does not affect the next call togcount().
References std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::goodbit, std::ios_base::in, std::basic_ios< _CharT, _Traits >::rdbuf(), std::basic_ios< _CharT, _Traits >::rdstate(), and std::basic_ios< _CharT, _Traits >::setstate().
π setf() β the one-arg version
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. additive, never subtractive β she's a "yes and" girlie π«Ά
Referenced by std::__detail::operator>>().
π setf() β the two-arg version
fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited]
Setting new format flags. again, but with intent π
Parameters
__fmtflβ Additional flags to set.__maskβ The flags mask forfmtfl.
Returns β The previous format control flags.
This function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield. clear first, then set β order matters, don't @ me π
π§ setstate()
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::setstate (iostate __state) [inline], [inherited]
Sets additional flags in the error state. adding to the chaos, not replacing it π
Parameters
__stateβ The additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
References std::basic_ios< _CharT, _Traits >::clear(), and std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by okay this list is long, deep breath: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ifstream< _CharT, _Traits >::close(), std::basic_ofstream< _CharT, _Traits >::close(), std::basic_fstream< _CharT, _Traits >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), and std::ws().
she's everywhere, she's booked and busy π
π str() β the getter
template<typename _CharT , typename _Traits , typename _Alloc > __string_type std::basic_istringstream< _CharT, _Traits, _Alloc >::str () const [inline]
Copying out the string buffer. getting the receipts π«Ά
Returns β rdbuf()->str()
βοΈ str() β the setter
template<typename _CharT , typename _Traits , typename _Alloc > void std::basic_istringstream< _CharT, _Traits, _Alloc >::str (const __string_type & __s) [inline]
Setting a new buffer. fresh content, who dis π
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. aligning energies, but for I/O β¨
Returns β 0 on success, -1 on failure
If rdbuf() is a null pointer, returns -1.
Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit and returns -1.
Otherwise, returns 0.
Note β This function does not count the number of characters extracted, if any, and therefore does not affect the next call to gcount().
References std::ios_base::badbit, std::ios_base::goodbit, std::basic_streambuf< _CharT, _Traits >::pubsync(), std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
π sync_with_stdio()
static bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]
Interaction with the standard C I/O objects. C and C++ finally talking to each other π«Ά
Parameters
__syncβ Whether to synchronize or not.
Returns β True if the standard streams were previously synchronized.
The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary
read that again, bestie: only the standard ones. your own custom streams are living their own life, untouched π
π tellg()
template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits >::pos_type std::basic_istream< _CharT, _Traits >::tellg (void) [inherited]
Getting the current read position. "where are we rn" but make it a pos_type π¦
Returns β A file position object.
If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,in).
Note β This function does not count the number of characters extracted, if any, and therefore does not affect the next call togcount(). At variance withputback,ungetandseekg,eofbitis not cleared first. yeah she plays by her own rules on that one π
- References
std::ios_base::badbit,std::ios_base::cur,std::basic_ios< _CharT, _Traits >::fail(),std::ios_base::in, andstd::basic_ios< _CharT, _Traits >::rdbuf().
π template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [inherited]
Fetches the current tied stream, bestie. Like, it goes and gets it.
Returns: a pointer to the tied stream, or NULL if the stream isn't tied. No tie, no problem π
A stream can be tied (aka synchronized) to a second output stream. Whenever this stream does any I/O, the tied stream gets flushed first. Classic example: std::cin is tied to std::cout. They're literally holding hands π«Ά
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::basic_ios< _CharT, _Traits >::copyfmt().
π template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie (basic_ostream< _CharT, _Traits > * __tiestr) [inline], [inherited]
Ties this stream to an output stream. Setting up the situationship β¨
Parameters
__tiestrβ the output stream.
Returns: the previously tied output stream, or NULL if the stream wasn't tied before.
This sets up a brand new tie; peep tie() for the deets.
πΈ template<typename _CharT , typename _Traits > basic_istream< _CharT, _Traits > & std::basic_istream< _CharT, _Traits >::unget (void) [inherited]
Unextracting the previous character. Yes that's a real word, we're going backwards π
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. Rude but okay π
Note β this function first clearseofbit. And since no characters are extracted, the next call togcount()returns0, exactly as DR 60 requires. Rules are rules.
References std::basic_istream< _CharT, _Traits >::_M_gcount, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::eofbit, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by std::__detail::operator>>().
π¦ void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited]
Clearing format flags β the opposite of setting them, iconically.
Parameters
__maskβ the flags to unset.
This function clears __mask in the format flags. Bye flag π
β template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited]
Widens characters. Glow-up for a single char π
Parameters
__cβ the character to widen.
Returns: the widened character.
Maps a character of char to a character of char_type.
It returns the result of:
std::use_facet<ctype<char_type> >(getloc()).widen(c)
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html β go read them, nerd π§
Referenced by std::endl(), std::basic_ios< _CharT, _Traits >::fill(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::getline(), std::operator<<(), std::operator<<(), and std::tr2::operator>>().
π streamsize std::ios_base::width () const [inline], [inherited]
Flags access π
Returns: the minimum field width to generate on output operations.
Minimum field width refers to the number of characters. Just characters. That's the whole unit, bestie.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
π streamsize std::ios_base::width (streamsize __wide) [inline], [inherited]
Changing flags. Same name, different job, main character energy π
Parameters
__wideβ the new width value.
Returns: the previous value of width().
π static int std::ios_base::xalloc () [static], [inherited]
Access to unique indices β the only one of its kind, fr fr.
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 literally any purpose, but it's primarily intended to be a unique index for the iword and pword functions. The whole idea is that an application calls xalloc to get an index into the iword and pword arrays that it can use without any fear of conflict. No drama, no collisions ποΈ
The implementation keeps a static variable that gets incremented and returned on each invocation. xalloc is guaranteed to return an index that's safe to use in the iword and pword arrays. Signed, sealed, delivered π
β¨ Member Data Documentation β¨
π§ template<typename _CharT , typename _Traits > streamsize std::basic_istream< _CharT, _Traits >::_M_gcount [protected], [inherited]
The number of characters extracted in the previous unformatted function; see gcount(). It's the receipts for how much was actually read π₯
Referenced by std::basic_istream< _CharT, _Traits >::~basic_istream(), std::basic_istream< _CharT, _Traits >::gcount(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< char >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< char >::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< char >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::readsome(), std::basic_istream< char >::sync(), and std::basic_istream< _CharT, _Traits >::unget().
π const fmtflags std::ios_base::adjustfield [static], [inherited]
A mask of left|right|internal. Super useful for the 2-arg form of setf. Three vibes, one mask π
Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().
π const openmode std::ios_base::app [static], [inherited]
Seek to end before each write. Every. Single. Write. Appending like it's a group chat π±
Referenced by std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
πΈ const openmode std::ios_base::ate [static], [inherited]
Open and seek to end immediately after opening. Not before each write β just the once, right at the start. Different from app, don't mix them up bestie π
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 β think an irrecoverable read error from a file. This is the bad one. Like, actually bad π
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< char >::tellg(), std::basic_istream< _CharT, _Traits >::tellg(), and std::ws().
π₯ const fmtflags std::ios_base::basefield [static], [inherited]
A mask of dec|oct|hex. Useful for the 2-arg form of setf. Pick your base, babe π’
Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().
π¦ const seekdir std::ios_base::beg [static], [inherited]
Request a seek relative to the beginning of the stream. Back to square one, queen π
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).
Real talk β this is probably not what you think it is. The original page links straight to https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary for the explanation. Go read it before you assume, bestie π«Ά
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 it's true/false instead of 1/0. Words, not numbers β¨
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. Here. Right here. π
Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
π const fmtflags std::ios_base::dec [static], [inherited]
Converts integer input or generates integer output in decimal base. The default one, the normal one, the everyone-uses-it one π
Referenced by std::dec().
π const seekdir std::ios_base::end [static], [inherited]
Request a seek relative to the current end of the sequence. To the end and beyond π
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 the whole file, bestie, nothing left π
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ios< _CharT, _Traits >::eof(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< char >::sync(), std::basic_istream< _CharT, _Traits >::unget(), 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 a total disaster like badbit, just a miss π«
(still finishing off that last constant's reference list β here's literally everywhere it gets poked at, and yes, a couple of these show up twice, that's just how the original list rolls π )
std::basic_istream< _CharT, _Traits >::sentry::sentry()std::basic_ostream< _CharT, _Traits >::sentry::sentry()std::basic_ifstream< _CharT, _Traits >::close()std::basic_ofstream< _CharT, _Traits >::close()std::basic_fstream< _CharT, _Traits >::close()std::num_get< _CharT, _InIter >::do_get()std::time_get< _CharT, _InIter >::do_get_monthname()std::time_get< _CharT, _InIter >::do_get_weekday()std::time_get< _CharT, _InIter >::do_get_year()std::basic_ios< _CharT, _Traits >::fail()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< char >::get()std::time_get< _CharT, _InIter >::get()std::basic_ifstream< _CharT, _Traits >::open()std::basic_fstream< _CharT, _Traits >::open()std::basic_ofstream< _CharT, _Traits >::open()std::basic_ifstream< _CharT, _Traits >::open()std::basic_fstream< _CharT, _Traits >::open()std::basic_ofstream< _CharT, _Traits >::open()std::operator<<()std::basic_istream< _CharT, _Traits >::operator>>()std::operator>>()std::basic_istream< _CharT, _Traits >::operator>>()std::basic_istream< _CharT, _Traits >::read()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_ostream< _CharT, _Traits >::seekp()
const fmtflags std::ios_base::fixed [static], [inherited]
Generates floating-point output in fixed-point notation. no more surprise 1e+06 jumpscares bestie π
Referenced by std::fixed(), and std::hexfloat().
const fmtflags std::ios_base::floatfield [static], [inherited]
A mask of scientific|fixed. Lowkey the whole reason the 2-arg form of setf exists β it's genuinely useful for that. π«Ά
Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
const iostate std::ios_base::goodbit [static], [inherited]
Indicates all is well. the "we're so back" of stream states β¨
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
const fmtflags std::ios_base::hex [static], [inherited]
Converts integer input or generates integer output in hexadecimal base. base 16 girlies rise π₯
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 for ifstream and fstream. π
Referenced by std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), 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 to right if no such point is designated. it's giving "pad in the middle, chaos on purpose" π¦
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.) π
Referenced by std::num_put< _CharT, _OutIter >::do_put(), and std::left().
const fmtflags std::ios_base::oct [static], [inherited]
Converts integer input or generates integer output in octal base. base 8 stays iconic π
Referenced by std::oct().
const openmode std::ios_base::out [static], [inherited]
Open for output. Default for ofstream and fstream. β¨
Referenced by std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), 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.) π
Referenced by std::right().
const fmtflags std::ios_base::scientific [static], [inherited]
Generates floating-point output in scientific notation. π§
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. the little 0x that ate, fr fr π
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. π
Referenced by std::noshowpoint(), and std::showpoint().
const fmtflags std::ios_base::showpos [static], [inherited]
Generates a + sign in non-negative generated numeric output. πΈ
Referenced by std::noshowpos(), and std::showpos().
const fmtflags std::ios_base::skipws [static], [inherited]
Skips leading white space before certain input operations. the "ignore the vibes, get to the content" flag β
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::noskipws(), std::__detail::operator>>(), and std::skipws().
const openmode std::ios_base::trunc [static], [inherited]
Truncate an existing stream when opening. Default for ofstream.
β οΈ bestie, clock it: this one nukes what was already in the file when it opens. That's the whole bit. Default behaviour for ofstream, so don't act surprised when your old contents ghost you π
const fmtflags std::ios_base::unitbuf [static], [inherited]
Flushes output after each output operation. impatient icon behaviour, honestly π
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. π
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.
and that's the whole page babes!! ππ this was std::basic_istringstream (stdlib... well, libstdc++, version 3cxx) straight from the Doxygen machine β go forth and stream responsibly, mwah π«Άβ¨π
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms