STD::BASIC_OSTREAM(3cxx)
β¨ NAME β¨
okay so manual name: 3cxx, and the header title up top is std::basic_ost...harT, _Traits >(3cxx) β but the actual main-character template we're talking about is std::basic_ostream< _CharT, _Traits >.
std::basic_ostream< _CharT, _Traits > β Template class basic_ostream. periodt, that's the name section, no cap π
πΈ SYNOPSIS πΈ
#include <ostream>
Inherits std::basic_ios< _CharT, _Traits >.
Inherited by std::basic_iostream< char >, std::basic_iostream< _CharT, _Traits >, std::basic_ofstream< _CharT, _Traits >, and std::basic_ostringstream< _CharT, _Traits, _Alloc >.
so yeah bestie, it inherits from std::basic_ios< _CharT, _Traits >, and the whole nepo-baby lineup that inherits from it is right there: std::basic_iostream< char >, std::basic_iostream< _CharT, _Traits >, std::basic_ofstream< _CharT, _Traits >, and std::basic_ostringstream< _CharT, _Traits, _Alloc > π¦
π Classes π
class sentryβ Performs setup work for output streams. literally the little pre-game routine for your stream, iconic
π¦ Public Types π¦
typedef ctype< _CharT > __ctype_typeβ a whole typedef, just existing and slayingtypedef basic_ios< _CharT, _Traits > __ios_typeβ thebasic_iostype, wrapped up with a bow πtypedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typeβ yes bestie, every character is in its placetypedef basic_ostream< _CharT, _Traits > __ostream_typeβ the ostream type itself, main character energytypedef basic_streambuf< _CharT, _Traits > __streambuf_typeβ streambuf type, underneath it alltypedef _CharT char_typeβ the character type, that's the_CharTvibeenum event { erase_event, imbue_event, copyfmt_event }β The set of events that may be passed to an event callback. all three events are here, not one is missingtypedef 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::int_type int_typeβ theint_typetypedef, no extra description on the page, just vibestypedef _Ios_Iostate iostateβ This is a bitmask type.typedef _Traits::off_type off_typeβoff_type, sitting there looking prettytypedef _Ios_Openmode openmodeβ This is a bitmask type.typedef _Traits::pos_type pos_typeβpos_type, another icontypedef _Ios_Seekdir seekdirβ This is an enumerated type.typedef _Traits traits_typeβ the traits type, periodttypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typeβ this one shows up right aftertraits_typein the original layout, so we are keeping it right here, bestie π«Ά
π§ Public Member Functions π§
okay deep breath, this is the big one. every single signature is staying, no skipping, no "you get the idea" behavior β we do not do that here π
basic_ostream (__streambuf_type *__sb)β Base constructor.virtual ~basic_ostream ()β Base destructor.const locale & _M_getloc () constβ Locale access.template<typename _ValueT > basic_ostream< _CharT, _Traits > & _M_insert (_ValueT __v)β signature only, no extra description on the pagevoid _M_setstate (iostate __state)β signature only, no extra description on the pagebool 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.__ostream_type & flush ()β Synchronizing the stream buffer.locale getloc () constβ Locale access.bool good () constβ Fast error checking.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.__ostream_type & operator<< (__streambuf_type *__sb)β Extracting from another streambuf.__ostream_type & operator<< (const void *__p)β Pointer arithmetic inserters.__ostream_type & operator<< (nullptr_t)β signature only, no extra description on the pagestreamsize precision () constβ Flags access.streamsize precision (streamsize __prec)β Changing flags.void *& pword (int __ix)β Access to void pointer array.basic_streambuf< _CharT, _Traits > * rdbuf () constβ Accessing the underlying buffer.basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb)β Changing the underlying buffer.iostate rdstate () constβ Returns the error state of the stream buffer.void register_callback (event_callback __fn, int __index)β Add the callback__fnwith parameter__index.__ostream_type & seekp (off_type, ios_base::seekdir)β Changing the current write position.__ostream_type & seekp (pos_type)β Changing the current write position.fmtflags setf (fmtflags __fmtfl)β Setting new format flags.fmtflags setf (fmtflags __fmtfl, fmtflags __mask)β Setting new format flags.void setstate (iostate __state)β Sets additional flags in the error state.pos_type tellp ()β Getting the current write position.basic_ostream< _CharT, _Traits > * tie () constβ Fetches the current tied stream.basic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr)β Ties this stream to an output stream.void unsetf (fmtflags __mask)β Clearing format flags.char_type widen (char __c) constβ Widens characters.streamsize width () constβ Flags access.streamsize width (streamsize __wide)β Changing flags.__ostream_type & operator<< (__ostream_type &(*__pf)(__ostream_type &))β Interface for manipulators.__ostream_type & operator<< (__ios_type &(*__pf)(__ios_type &))β Interface for manipulators.__ostream_type & operator<< (ios_base &(*__pf)(ios_base &))β Interface for manipulators.
π Inserters π
All the operator<< functions (aka formatted output functions) have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This can have several effects, concluding with the setting of a status flag; see the sentry documentation for more.
If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state without causing an ios_base::failure to be thrown. The original exception will then be rethrown.
__ostream_type & operator<< (long __n)β Integer arithmetic inserters.__ostream_type & operator<< (unsigned long __n)β Integer arithmetic inserters.__ostream_type & operator<< (bool __n)β Integer arithmetic inserters.__ostream_type & operator<< (short __n)β Integer arithmetic inserters.__ostream_type & operator<< (unsigned short __n)β Integer arithmetic inserters.__ostream_type & operator<< (int __n)β Integer arithmetic inserters.__ostream_type & operator<< (unsigned int __n)β Integer arithmetic inserters.__ostream_type & operator<< (long long __n)β Integer arithmetic inserters.__ostream_type & operator<< (unsigned long long __n)β Integer arithmetic inserters.__ostream_type & operator<< (double __f)β Floating point arithmetic inserters.__ostream_type & operator<< (float __f)β Floating point arithmetic inserters.__ostream_type & operator<< (long double __f)β Floating point arithmetic inserters.
π Unformatted Output Functions π
All the unformatted output functions have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.
If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.
If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state. If badbit is on in the stream's exceptions mask, the exception will be rethrown without completing its actions.
__ostream_type & put (char_type __c)β Simple insertion.__ostream_type & write (const char_type *__s, streamsize __n)β Character string insertion.operator bool () constβ The quick-and-easy status check.bool operator! () constβ The quick-and-easy status check.
π Static Public Member Functions π
static bool sync_with_stdio (bool __sync=true)β Interaction with the standard C I/O objects.static int xalloc () throw ()β Access to unique indices. yes, the double space beforethrow ()is staying, we are not "fixing" it, bestie
part 1 of 7 is loaded, and the rest of the page is still coming β do not close the tab π
π Static Public Attributes π
static const openmode __noreplaceβ the source gives this one no description, so we're not gonna invent lore. It's just there, mysterious and iconic. β¨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 }β that's the enum, bestie. No extra blurb in the source. π¦
πΈ Protected Member Functions πΈ
basic_ostream (basic_iostream< _CharT, _Traits > &)basic_ostream (basic_ostream &&__rhs)basic_ostream (const basic_ostream &)=deletevoid _M_cache_locale (const locale &__loc)void _M_call_callbacks (event __ev) throw ()void _M_dispose_callbacks (void) throw ()_Words & _M_grow_words (int __index, bool __iword)void _M_init () throw ()template<typename _ValueT > __ostream_type & _M_insert (_ValueT __v)void _M_move (ios_base &) noexceptvoid _M_swap (ios_base &__rhs) noexceptvoid init (basic_streambuf< _CharT, _Traits > *__sb)β all setup is performed here. π οΈvoid move (basic_ios &&__rhs)void move (basic_ios &__rhs)basic_ostream & operator= (basic_ostream &&__rhs)basic_ostream & operator= (const basic_ostream &)=deletevoid set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)void swap (basic_ios &__rhs) noexceptvoid swap (basic_ostream &__rhs)
π Protected Attributes π
_Callback_list * _M_callbacksconst __ctype_type * _M_ctypeiostate _M_exceptionchar_type _M_fillbool _M_fill_initfmtflags _M_flagslocale _M_ios_locale_Words _M_local_word [_S_local_word_size]const __num_get_type * _M_num_getconst __num_put_type * _M_num_putstreamsize _M_precisionbasic_streambuf< _CharT, _Traits > * _M_streambufiostate _M_streambuf_statebasic_ostream< _CharT, _Traits > * _M_tiestreamsize _M_width_Words * _M_wordint _M_word_size_Words _M_word_zero
π¦ Friends π¦
class sentryβ sentry is a friend of the class. We love a supportive bestie. π«Ά
π Detailed Description π
template<typename _CharT, typename _Traits>
class std::basic_ostream< _CharT, _Traits >
Template class basic_ostream. π
β¨ Template Parameters β¨
_CharTβ type of character stream._Traitsβ traits for character type, defaults tochar_traits<_CharT>.
This is the base class for all output streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual output. π
π Member Typedef Documentation π
typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_get_type [inherited]β these are non-standard types. Not standard, but they're here and they're doing their thing. πtypedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited]β the type of an event callback function.__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 severalios_baseandbasic_iosfunctions, specificallyimbue(),copyfmt(), and~ios(). π£
typedef _Ios_Fmtflags std::ios_base::fmtflags [inherited]β this is a bitmask type._Ios_Fmtflagsis implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of typefmtflagsare:boolalphadecfixedhexinternalleftoctrightscientificshowbaseshowpointshowposskipwsunitbufuppercaseadjustfieldbasefieldfloatfield
typedef _Ios_Iostate std::ios_base::iostate [inherited]β this is a bitmask type._Ios_Iostateis implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of typeiostateare:badbiteofbitfailbitgoodbit
typedef _Ios_Openmode std::ios_base::openmode [inherited]β this is a bitmask type._Ios_Openmodeis implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of typeopenmodeare:appatebinaryinouttrunc
typedef _Ios_Seekdir std::ios_base::seekdir [inherited]β this is an enumerated type._Ios_Seekdiris implementation-defined. Defined values of typeseekdirare: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_eventis used during~ios()andcopyfmt().imbue_eventis used duringimbue().copyfmt_eventis used duringcopyfmt(). π
π Constructor & Destructor Documentation π
template<typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits >::basic_ostream (__streambuf_type * __sb) [inline], [explicit]β base constructor. This ctor is almost never called by the user directly, rather from derived classes' initialization lists, which pass a pointer to their own stream buffer. Referencesstd::basic_ios< _CharT, _Traits >::init().template<typename _CharT , typename _Traits > virtual std::basic_ostream< _CharT, _Traits >::~basic_ostream () [inline], [virtual]β base destructor. This does very little apart from providing a virtual base dtor.
π Member Function Documentation π
const locale & std::ios_base::_M_getloc () const [inline], [inherited]β locale access. Returns: a reference to the current locale. Likegetlocabove, but returns a reference instead of generating a copy. Referenced bystd::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(), andstd::time_put< _CharT, _OutIter >::put().template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [inherited]β fast error checking. Returns: true if thebadbitis set. Note that otheriostateflags may also be set. Referencesstd::ios_base::badbit, andstd::basic_ios< _CharT, _Traits >::rdstate(). Referenced bystd::basic_ostream< _CharT, _Traits >::sentry::sentry().template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]β [Re]sets the error state. Parameters:__stateβ the new state flag(s) to set. Seestd::ios_base::iostatefor the possible bit values. Most users will not need to pass an argument. π§Ό
Referenced by (still rolling over from the last one, she's long π): 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() β the "steal her whole personality" function [inherited]
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 glow-up-by-osmosis, bestie. β¨
Parameters
__rhsβ the source values for the copies.
Returns
Reference to this object.
The actual tea β: all fields of __rhs are copied into this object except that rdbuf() and rdstate() stay exactly as they were (no touchy). All values in the pword and iword arrays get copied too. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions(). Order matters, she's a whole ritual. π―οΈ
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() β the quick vibe check for end-of-file [inline], [inherited]
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [inherited]
Fast error checking. Literally a speedrun. πββοΈπ¨
Returns
True if the eofbit is set.
Heads up bestie: other iostate flags may also be set. So like, don't read too much into it. π
References: std::ios_base::eofbit, and std::basic_ios< _CharT, _Traits >::rdstate().
πΈ exceptions() (getter) β peeking at the throw mask [inline], [inherited]
template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [inherited]
Throwing exceptions on errors. Dramatic? Maybe. Correct? Yes. π
Returns
The current exceptions mask.
This changes nothing in the stream β total window shopping, no buying. 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) β setting the throw mask, aka the drama switch [inline], [inherited]
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline], [inherited]
Throwing exceptions on errors.
Parameters
__exceptβ the new exceptions mask.
So here's the sitch: by default, error flags are set silently (no cap, they just sit there). But you can set an exceptions mask for each stream β if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown. π¨
And this is the spicy part π₯: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. Not later. Right then. 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() β the fast "is she okay?" check [inline], [inherited]
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [inherited]
Fast error checking.
Returns
True if either the badbit or the failbit is set.
Checking the badbit in fail() is historical practice β think vintage, not vibes-based. π°οΈ And 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() (getter) β what's the empty character rn? [inline], [inherited]
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [inherited]
Retrieves the empty character.
Returns
The current fill character.
It defaults to a space (' ') in the current locale. Basic, but make it fashion. π
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) β setting a new empty character [inline], [inherited]
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.
So 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 but make it cute. β¨
References: std::basic_ios< _CharT, _Traits >::fill().
β flags() (getter) β access to format flags [inline], [inherited]
fmtflags std::ios_base::flags () const [inline], [inherited]
Access to format flags.
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) β setting ALL the format flags at once [inline], [inherited]
fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once.
Parameters
__fmtflβ the new flags to set.
Returns
The previous format control flags.
This function overwrites all the format flags with __fmtfl. Not a merge, not a vibe-share β a full replace. She ate. π
π flush() β synchronizing the stream buffer
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush ()
Synchronizing the stream buffer.
Returns
*this
If rdbuf() is a null pointer, changes nothing. Crickets. π¦
Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit. Rude of it, but okay. π
References: std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::flush().
π getloc() β locale access [inline], [inherited]
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. No locale? She'll just go get the global one herself, independent queen. π
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().
π¦ good() β the actual vibe check [inline], [inherited]
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. Tiny function, huge responsibility. π«Ά
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>>().
πΈ imbue() β moving to a new locale [inherited]
template<typename _CharT , typename _Traits > locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]
Moves to a new locale. Relocation era. π§³β¨
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). Everybody gets the memo, fr fr. π¬
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
References: std::ios_base::imbue().
Referenced by std::chrono::operator<<().
π§ init() β where all the setup actually happens [protected], [inherited]
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. So like, don't try it bestie, she's not open to edits. π ββοΈ
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().
π iword() β access to the integer array [inline], [inherited]
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. It's a free-for-all, do what you want with it. β¨ The array grows as required to hold the supplied index. All integers in the array are initialized to 0.
β οΈ Okay listen, two things: the implementation reserves several indices, so you should use xalloc to obtain an index that is safe to use. Also, since the array can grow dynamically, it is not safe to hold onto the reference. Like, don't get attached. She moves. π
π narrow() β squeezes characters [inline], [inherited]
template<typename _CharT , typename _Traits > char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]
Squeezes characters. Compression core. ποΈ
Parameters
__cβ the character to narrow.__dfaultβ the character to narrow.
Returns
The narrowed character.
Okay so for the narrow vibe: it maps a character of char_type to a character of char, if thatβs even possible π
. It 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, no cap π«Ά. This lets you write constructs such as if (!a_stream) ... and while (a_stream) ...
References: std::basic_ios< _CharT, _Traits >::fail().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::operator! () const [inline], [inherited]
Same quick-and-easy status check energy π. This lets you write constructs such as if (!a_stream) ... and while (a_stream) ...
References: std::basic_ios< _CharT, _Traits >::fail().
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (__ios_type &(*)(__ios_type &) __pf) [inline]
Interface for manipulators, bestie π. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (__ostream_type &(*)(__ostream_type &) __pf) [inline]
Interface for manipulators again, and yes itβs iconic β¨. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (__streambuf_type * __sb)
Extracting from another streambuf π.
Parameters
__sbβ A pointer to a streambuf
This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.
If __sb is NULL, the stream will set failbit in its error state.
Characters are extracted from __sb and inserted into *this until one of the following occurs:
- the input stream reaches end-of-file,
- insertion into the output sequence fails (in this case, the character that would have been inserted is not extracted), or
- an exception occurs while getting a character from
__sb, which setsfailbitin the error state
If the function inserts no characters, failbit is set.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (bool __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (const void * __p) [inline]
Pointer arithmetic inserters π.
Parameters
__pβ A variable of pointer type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (double __f) [inline]
Floating point arithmetic inserters π₯.
Parameters
__fβ A variable of builtin floating point type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (float __f) [inline]
Floating point arithmetic inserters, yes again, and we love consistency π .
Parameters
__fβ A variable of builtin floating point type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (int __n)
Integer arithmetic inserters π§.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (ios_base &(*)(ios_base &) __pf) [inline]
Interface for manipulators π. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long double __f) [inline]
Floating point arithmetic inserters β¨.
Parameters
__fβ A variable of builtin floating point type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long long __n) [inline]
Integer arithmetic inserters π¦.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (short __n)
Integer arithmetic inserters πΈ.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
References:std::ios_base::badbit,std::ios_base::goodbit, andstd::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned int __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long long __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned short __n) [inline]
Integer arithmetic inserters π.
Parameters
__nβ A variable of builtin integral type.
Returns
*thisif successful
These functions use the streamβs current locale (specifically, the num_get facet) to perform numeric formatting.
streamsize std::ios_base::precision () const [inline], [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.
Referenced by:std::basic_ios< _CharT, _Traits >::copyfmt(), andstd::chrono::operator<<().
streamsize std::ios_base::precision (streamsize __prec) [inline], [inherited]
Changing flags π.
Parameters
__precβ The new precision value.
Returns
- The previous value of
precision().
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::put (char_type __c)
Simple insertion πΈ.
Parameters
__cβ The character to insert.
Returns
*this
Tries to insert __c.
Note: This function is not overloaded onsigned charandunsigned char.
References:std::ios_base::badbit,std::ios_base::goodbit,std::basic_ios< _CharT, _Traits >::rdbuf(), andstd::basic_ios< _CharT, _Traits >::setstate().
Referenced by:std::endl(), andstd::ends().
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.
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.
template<typename _CharT , typename _Traits > basic_streambuf< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::rdbuf () const [inline], [inherited]
Accessing the underlying buffer π¦.
Returns
- The current stream buffer.
This does not change the state of the stream.
β¦and bestie, the previous function is also referenced by this absolutely stacked group chat of icons:
std::basic_istream< _CharT, _Traits >::sentry::sentry()std::basic_ostream< _CharT, _Traits >::sentry::~sentry()std::basic_ostream< _CharT, _Traits >::flush()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< _CharT, _Traits >::get()std::basic_istream< char >::get()std::basic_istream< _CharT, _Traits >::get()std::getline()std::getline()std::basic_istream< _CharT, _Traits >::ignore()std::basic_istream< _CharT, _Traits >::ignore()std::operator<<()std::basic_istream< _CharT, _Traits >::operator>>()std::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< char >::readsome()std::basic_istream< _CharT, _Traits >::readsome()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_istream< _CharT, _Traits >::sync()std::basic_istream< _CharT, _Traits >::tellg()std::basic_ostream< _CharT, _Traits >::tellp()std::ws()
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. iconic little buffer-swap moment π
Parameters
__sbβ the new stream buffer π
Returns
- The previous stream buffer.
Associates a new buffer with the current stream, and clears the error state.
β οΈ okay so this is a whole historical-accidents situation: 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>
template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [inherited]
Returns the error state of the stream buffer. vibe check: whatβs the stream feeling rn? π¦
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().
Also 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().
void std::ios_base::register_callback (event_callback __fn, int __index) [inherited]
Add the callback __fn with parameter __index. callback registration, but make it cute β¨
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.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (off_type __off, ios_base::seekdir __dir)
Changing the current write position. scoot scoot, output cursor π
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.
References: std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (pos_type __pos)
Changing the current write position. same energy, different coordinates π¦
Parameters
__posβ a file position object.
Returns
*this
If fail() is not true, calls rdbuf()->pubseekpos(pos). If that function fails, sets failbit.
References: std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
fmtflags std::ios_base::setf (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags. flags on flags on flags, no cap β
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.
Also referenced by: std::__detail::operator>>().
fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited]
Setting new format flags. masked-up little flag situation π
Parameters
__fmtflβ additional flags to set.__maskβ the flags mask forfmtfl.
Returns
- The previous format control flags.
This function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield.
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::setstate (iostate __state) [inline], [inherited]
Sets additional flags in the error state. error-state glow-up, but make it bitwise π
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().
Also referenced by, and bestie this list is long, so buckle up:
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()std::ws()
static bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]
Interaction with the standard C I/O objects. C I/O and C++ I/O walking into the same room π
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
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp ()
Getting the current write position. whereβs the output cursor at? letβs ask her π
Returns
- A file position object.
If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,out).
References: std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::out, and std::basic_ios< _CharT, _Traits >::rdbuf().
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [inherited]
Fetches the current tied stream. who is she emotionally attached to? asking for a stream π¦
Returns
- A pointer to the tied stream, or
NULLif the stream is not tied.
A stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream is first flushed. For example, std::cin is tied to std::cout.
Also 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. establishing the link, the lore, the bond π
Parameters
__tiestrβ the output stream.
Returns
- The previously tied output stream, or
NULLif the stream was not tied.
This sets up a new tie; see tie() for more.
void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited]
Clearing format flags. un-stanning a flag π
Parameters
__maskβ the flags to unset.
This function clears __mask in the format flags.
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited]
Widens characters. char says βmake me bigger,β and she does β
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 http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
Also 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. how wide are we printing, babes? π
Returns
- The minimum field width to generate on output operations.
Minimum field width refers to the number of characters.
Also 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. short queen behavior, honestly π
Parameters:
__wideβ the new width value, slay.
Returns: the previous value of width(). Yep, it hands you back the old one so you can restore it later, iykyk.
πΈ template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::write (const char_type * __s, streamsize __n)
Okay so this one is literally called Character string insertion and it's giving main character energy for real.
Parameters:
__sβ the array to insert π__nβ maximum number of characters to insert
Returns *this.
So here's the vibe: characters get copied from __s and inserted into the stream, and this keeps going until one of these two things happens:
__ncharacters are inserted β- inserting into the output sequence fails β and in that case,
badbitgets set in the stream's error state π
Note bestie: this function is not overloaded onsigned charandunsigned char. Don't come for it, that's just how it is.
π¦ static int std::ios_base::xalloc () [static], [inherited]
Access to unique indices. Returns an integer different from all previous calls. No cap.
This function returns a unique integer every single time you call it β every time, fr fr. 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. Iconic behaviour, honestly.
β¨ MEMBER DATA DOCUMENTATION β¨
π const fmtflags std::ios_base::adjustfield [static], [inherited]
A mask of left|right|internal. Useful for the 2-arg form of setf. Lowkey handy.
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. π
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 the same as app, bestie β app seeks before each write, ate does it once at open time. The page says what it says, and that's what it says.)
Referenced by std::basic_filebuf< _CharT, _Traits >::open().
π const iostate std::ios_base::badbit [static], [inherited]
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). This is the bad one. The really bad one. π
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.
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. Classic. The original. The blueprint. π
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).
β οΈ Heads up: this is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. For real, read the link before you fight me on it.
Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().
π«Ά const fmtflags std::ios_base::boolalpha [static], [inherited]
Insert/extract bool in alphabetic rather than numeric format. So true instead of 1, which is honestly so much more readable π
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. It's giving "where am I right now" energy.
Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
πΈ const fmtflags std::ios_base::dec [static], [inherited]
Converts integer input or generates integer output in decimal base. Base 10, the people's base.
Referenced by std::dec().
π const seekdir std::ios_base::end [static], [inherited]
Request a seek relative to the current end of the sequence. The finale. The last page of the book. π
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. You hit the wall, bestie. There's nothing left to read.
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 the end of the world like badbit, but it's still a whole mood. π
Referenced by 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(), and std::basic_ostream< _CharT, _Traits >::seekp().
π₯ const fmtflags std::ios_base::fixed [static], [inherited]
Generate floating-point output in fixed-point notation. No sneaky exponent jumps, just the digits, bestie.
Referenced by std::fixed(), and std::hexfloat().
π const fmtflags std::ios_base::floatfield [static], [inherited]
A mask of scientific|fixed. Useful for the 2-arg form of setf.
Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
π§ const iostate std::ios_base::goodbit [static], [inherited]
Indicates all is well. β¨ The dream. The goal. Zero problems, zero drama.
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. The standard-issue opening move, no notes.
const fmtflags std::ios_base::internal[static],[inherited]β drops fill characters at a designated internal point in certain generated output. No internal point designated? Then it's literally identical toright. Lowkey the flex of formatting flags π
Referenced by std::internal().
const fmtflags std::ios_base::left[static],[inherited]β puts fill characters on the right (the final positions) of certain generated output. Translating for the group chat: 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 eight supremacy, no cap β¨
Referenced by std::oct().
const openmode std::ios_base::out[static],[inherited]β open for output. This is the default forofstreamandfstream, so bestie you get it for free π
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(). (Yes it's a whole entourage. It's giving main character energy π)
const fmtflags std::ios_base::right[static],[inherited]β adds fill characters on the left (the initial positions) of certain generated output. In human words: 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. Big science vibes π₯
Referenced by std::hexfloat(), and std::scientific().
const fmtflags std::ios_base::showbase[static],[inherited]β generates a prefix that indicates the numeric base of generated integer output. So everyone knows which base you're serving π
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. Unconditional, like my love for clean 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. Positivity, literally π
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 them, they're not worth it" of flags π
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. This is the default forofstream. β οΈ Yeah, it wipes what was there β that's the whole point, so don't come for me when your file is gone πconst fmtflags std::ios_base::unitbuf[static],[inherited]β flushes output after each output operation. Impatient queen behavior, and honestly valid π§
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. SHOUTING, but make it formatted β¨
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. Not me, not you, not anyone's fave β Doxygen did that. Iconic of it, fr fr π€π
Okay that's the whole page, bestie β every flag, every Referenced by, every last crumb. This one's libstdc++'s std::basic_ostream< _CharT, _Traits >(3cxx) man page, straight from the Doxygen-generated source code, and you read the entire thing. Obsessed with your commitment. Go take a lil break, drink some water, and remember: std::endl flushes, so use it wisely ππ«Άπ
π¦ 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