STD::WOSTREAM(3)
๐ std::basic_ostream< _CharT, _Traits > โ Library Functions Manual ๐
โจ NAME โจ
std::basic_ostream< _CharT, _Traits > โ Template class basic_ostream.
okay bestie, sheโs the output-stream template and she is iconic. No cap. ๐
๐ธ SYNOPSIS ๐ธ
#include <ostream>
Inherits std::basic_ios< _CharT, _Traits >.
Inherited by std::basic_iostream< char >, std::basic_iostream< wchar_t >, std::basic_ofstream< char >, std::basic_ofstream< wchar_t >, std::basic_ostringstream< char >, std::basic_ostringstream< wchar_t >, 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. She does the pre-game setup before the output stream does its thing. ๐ซถ
๐ Public Types ๐
typedef ctype< _CharT > __ctype_typetypedef basic_ios< _CharT, _Traits > __ios_typetypedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typetypedef basic_ostream< _CharT, _Traits > __ostream_typetypedef basic_streambuf< _CharT, _Traits > __streambuf_typetypedef _CharT char_typeenum event { erase_event, imbue_event, copyfmt_event }โ The set of events that may be passed to an event callback.typedef void(* event_callback) (event __e, ios_base &__b, int __i)โ The type of an event callback function.typedef _Ios_Fmtflags fmtflagsโ This is a bitmask type.typedef _Traits::int_type int_typetypedef _Ios_Iostate iostateโ This is a bitmask type.typedef _Traits::off_type off_typetypedef _Ios_Openmode openmodeโ This is a bitmask type.typedef _Traits::pos_type pos_typetypedef _Ios_Seekdir seekdirโ This is an enumerated type.typedef _Traits traits_typetypedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_type
๐ฅ Public Member Functions ๐ฅ
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)void _M_setstate (iostate __state)bool bad () constโ Fast error checking.void clear (iostate __state=goodbit)โ[R]setsthe 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<< (const volatile void *__p)__ostream_type & operator<< (nullptr_t)streamsize precision () constโ Flags access.streamsize precision (streamsize __prec)โ Changing flags.void *& pword (int __ix)โ Access to void pointer array.basic_streambuf< _CharT, _Traits > * rdbuf () constโ Accessing the underlying buffer.basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb)โ Changing the underlying buffer.iostate rdstate () constโ Returns the error state of the stream buffer.void register_callback (event_callback __fn, int __index)โ Add the callback__fnwith parameter__index.__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.
bestie, read that again:badbitgets turned on, noios_base::failuregets thrown, and then the original exception is rethrown. That's the rule. ๐
__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.
โจ Static Public Attributes โจ
okay bestie, gather round. these are the static constants that live on the class. no cap, they're iconic. ๐
static const openmode __noreplaceโ there's literally no description for this one, she just exists. ๐ซถstatic const fmtflags adjustfieldโ a mask ofleft|right|internal. lowkey useful for the 2-arg form ofsetf. ๐static const openmode appโ seek to end before each write. periodt.static const openmode ateโ open and seek to end immediately after opening. no cap.static const iostate badbitโ indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). it's giving "something went wrong" energy. ๐ญ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. classic.static const openmode binaryโ perform input and output in binary mode (as opposed to text mode). ngl this is probably not what you think it is; seehttps://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. bestie read that link. ๐ฆstatic const fmtflags boolalphaโ insert/extractboolin alphabetic rather than numeric format. slay.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. bye.static const iostate failbitโ indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. not the vibe.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. we love to see it. ๐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.). flush left queen. ๐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.). flush right queen. ๐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. flush after every op, she's thorough.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 whole vibe. no extra tea. ๐ฆ
๐ซถ 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โ the sentry is a friend, periodt.
๐ 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. main character energy, fr fr. ๐
๐ Member Typedef Documentation ๐
__num_get_type
template<typename _CharT, typename _Traits> typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_get_type [inherited]
These are non-standard types. ๐
event_callback
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().
fmtflags
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
iostate
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
openmode
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
seekdir
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 ๐
basic_ostream(__streambuf_type* __sb)
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.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and operator<<().
~basic_ostream()
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 ๐
_M_getloc()
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.
Referenced by std::money_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().
bad()
template<typename _CharT, typename _Traits>
bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns:
- True if the
badbitis set.
Note that other iostate flags may also be set.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry().
clear()
template<typename _CharT, typename _Traits>
void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]
[Re]sets the error state.
Parameters:
__stateโ The new state flag(s) to set.
See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument.
References std::ios_base::badbit, exceptions(), rdbuf(), and rdstate().
...the full squad that references it, bestie, and yes every single one of them:
std::basic_ios< char_type, traits_type >::exceptions()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::__detail::operator>>()std::basic_istream< _CharT, _Traits >::putback()rdbuf()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_ios< char_type, traits_type >::setstate()std::basic_istream< _CharT, _Traits >::unget()
(Yes, some of these show up twice in the original list. That's just how it is. We don't question the list. We respect the list. ๐ )
๐ช 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-cloning, honestly.
Parameters
__rhsโ the source values for the copies.
Returns
- Reference to this object.
Okay so the tea: all fields of __rhs get copied into this object, except that rdbuf() and rdstate() stay exactly how they were. All the values sitting in the pword and iword arrays? Copied. Before the copying even happens, each callback gets invoked with erase_event. After the copying, each (new) callback gets invoked with copyfmt_event. And then the final step, the little bow on top, is copying exceptions().
References basic_ios(), std::__addressof(), exceptions(), fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), tie(), std::tie(), and std::ios_base::width().
๐จ template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [nodiscard], [inherited]
Fast error checking. Speed-run status check, basically.
Returns
Trueif theeofbitis set.
Heads up bestie: other iostate flags may also be set. Don't assume it's only eof. ๐
๐ฅ template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [nodiscard], [inherited]
Throwing exceptions on errors.
Returns
- The current exceptions mask.
This one changes nothing in the stream, it's purely a peek. Wanna know what the return value actually means? Go read the one-argument version, exceptions(iostate). It's all there.
Referenced by clear(), and copyfmt().
๐ฏ template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline], [inherited]
Throwing exceptions on errors. The sequel. The one with the plot twist.
Parameters
__exceptโ the new exceptions mask.
So by default, error flags just get set silently, no drama, no announcement. But you can set an exceptions mask for each stream. And if a bit in the mask becomes set in the error flags? Boom โ an exception of type std::ios_base::failure gets thrown.
And here's the part that catches people: if the error flag is already set when you add the exceptions mask, the exception is thrown immediately. Like, right then. No waiting. 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);
}
๐ฉบ template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns
Trueif either thebadbitor thefailbitis set.
Checking the badbit inside fail() is historical practice โ that's just the lore, okay? And again: note that other iostate flags may also be set.
Referenced by std::basic_ios< char_type, traits_type >::operator bool(), std::basic_ios< char_type, traits_type >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
๐ template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [nodiscard], [inherited]
Retrieves the empty character. The lil filler character. The one who pads out your formatting.
Returns
- The current fill character.
It defaults to a space (' ') in the current locale.
Referenced by copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
๐ธ template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::fill (char_type __ch) [inline], [inherited]
Sets a new empty character. Pick your own padding, diva.
Parameters
__chโ the new character.
Returns
- The previous fill character.
So the fill character is what gets used to fill out space when P+ characters have been requested (like, say, via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale.
๐ฉ fmtflags std::ios_base::flags () const [inline], [nodiscard], [inherited]
Access to format flags.
Returns
- The format control flags for both input and output.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
๐๏ธ fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once. One shot, whole new personality.
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, bestie. A full replacement. The old flags are gone-gone.
๐ฐ 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, it changes nothing. Otherwise it calls rdbuf()->pubsync(), and if that returns -1, it sets badbit. Simple as.
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().
๐ locale std::ios_base::getloc () const [inline], [nodiscard], [inherited]
Locale access.
Returns
- A copy of the current locale.
Here's how it decides: if imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::basic_ios< _CharT, _Traits >::imbue(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().
โ
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::good () const [inline], [nodiscard], [inherited]
Fast error checking.
Returns
Trueif no error flags are set.
It's literally a wrapper around rdstate. Nothing more, nothing less.
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> locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]
Moves to a new locale. Glow-up, but make it internationalization.
Parameters
__locโ the new locale.
Returns
- The previous locale.
It calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, it calls that buffer's pubimbue(loc) too.
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
References std::ios_base::getloc(), std::ios_base::imbue(), and rdbuf().
Referenced by std::chrono::operator<<().
๐ ๏ธ template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]
All setup is performed here. This is called from the public constructor. It is not virtual and cannot be redefined. Periodt.
Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().
๐ข long & std::ios_base::iword (int __ix) [inline], [inherited]
Access to integer array.
Parameters
__ixโ index into the array.
Returns
- A reference to an integer associated with the index.
So the iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0.
โ ๏ธ The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. Fr fr, don't be out here storing that reference like it's gonna last forever. It will not.
References iword().
Referenced by iword().
(Yes. It references itself and is referenced by itself. Main character energy. ๐)
๐ template<typename _CharT, typename _Traits> char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]
Squeezes characters. Compression, but for characters.
Parameters
__cโ the character to narrow.__dfaultโ the character to narrow.
Returns
- The narrowed character.
Maps a character of char_type to a character of char, if possible.
Returns the result of
std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
๐ซถ template<typename _CharT, typename _Traits> std::basic_ios< _CharT, _Traits >::operator bool () const [inline], [explicit], [nodiscard], [inherited]
The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) ...
๐
operator! โ the quick-and-easy status check
template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
_Traits >::operator! () const [inline], [nodiscard], [inherited]
okay so this is the quick-and-easy status check โจ. It lets you write constructs such as if (!a_stream) ... and while (a_stream) ... โ super handy for vibe checks, no cap. ๐ซถ
โจ operator<< โ manipulator interface (ios_type)
template<typename _CharT, typename _Traits> __ostream_type &
std::basic_ostream< _CharT, _Traits >::operator<< (__ios_type &(* __pf
)(__ios_type &)) [inline]
This is the interface for manipulators ๐. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header ๐.
๐ฆ operator<< โ manipulator interface (ostream_type)
template<typename _CharT, typename _Traits> __ostream_type &
std::basic_ostream< _CharT, _Traits >::operator<< (__ostream_type &(*
__pf )(__ostream_type &)) [inline]
Same vibe, bestie: interface for manipulators ๐ฆ. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header.
๐ operator<< โ extracting from another streambuf
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.
๐ข operator<< โ integer arithmetic inserters (bool)
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.
๐ operator<< โ pointer arithmetic inserters
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.
๐งฎ operator<< โ floating point arithmetic inserters (double)
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.
๐ธ operator<< โ floating point arithmetic inserters (float)
template<typename _CharT, typename _Traits> __ostream_type &
std::basic_ostream< _CharT, _Traits >::operator<< (float __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.
๐ฅ operator<< โ integer arithmetic inserters (int)
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.
๐ operator<< โ manipulator interface (ios_base)
template<typename _CharT, typename _Traits> __ostream_type &
std::basic_ostream< _CharT, _Traits >::operator<< (ios_base &(* __pf
)(ios_base &)) [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.
๐ operator<< โ integer arithmetic inserters (long)
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.
๐ operator<< โ floating point arithmetic inserters (long double)
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.
โญ operator<< โ integer arithmetic inserters (long long)
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.
๐ operator<< โ integer arithmetic inserters (short)
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:
basic_ostream(), std::ios_base::badbit, std::ostreambuf_iterator< _CharT, _Traits >::failed(), std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet().
๐ง operator<< โ integer arithmetic inserters (unsigned int)
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.
๐ซ operator<< โ integer arithmetic inserters (unsigned long)
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.
๐ซถ operator<< โ integer arithmetic inserters (unsigned long long)
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.
๐ operator<< โ integer arithmetic inserters (unsigned short)
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.
๐ฉ precision โ get the precision
streamsize std::ios_base::precision () const [inline], [nodiscard],
[inherited]
Flags access ๐ฉ
Returns
- The precision to generate on certain output operations.
Be careful if you try to give a definition of precision here; see DR 189.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().
๐๏ธ precision โ set the precision
streamsize std::ios_base::precision (streamsize __prec) [inline],
[inherited]
Changing flags ๐๏ธ
Parameters
__precโ The new precision value.
Returns
- The previous value of
precision().
โ๏ธ put โ simple insertion
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(), and std::basic_ios< _CharT, _Traits >::setstate().
Referenced by std::endl(), and std::ends().
๐๏ธ pword โ access to void pointer array
void *& std::ios_base::pword (int __ix) [inline], [inherited]
Access to void pointer array ๐๏ธ
Parameters
__ixโ Index into the array.
Returns
- A reference to a
void*associated with the index.
The pword function provides access to an array of pointers that can be used for any purpose. The array grows as required to hold the supplied index. All pointers in the array are initialized to 0.
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.
๐ rdbuf โ accessing the underlying buffer
template<typename _CharT, typename _Traits> basic_streambuf< _CharT, _Traits
> * std::basic_ios< _CharT, _Traits >::rdbuf () const [inline],
[nodiscard], [inherited]
Accessing the underlying buffer ๐
Returns
- The current stream buffer.
This does not change the state of the stream.
Referenced by the whole squad:
clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), imbue(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_ostream< _CharT, _Traits >::tellp(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
template<typename _CharT, typename _Traits> basic_streambuf< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::rdbuf (basic_streambuf< _CharT, _Traits > * __sb) [inherited]
okay bestie, this one is literally called Changing the underlying buffer. ๐
Parameters
__sbโ the brand new stream buffer, slay.
Returns
- the previous stream buffer. yes queen, we hand it back to you.
So what it does: it associates a new buffer with the current stream, and (bonus!) clears the error state. โจ
โ ๏ธ girlypop, listen up, because this is the messy part. Due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. ๐ As a result, you must use explicit qualifications to access this function via any derived class. For example:
std::fstream foo; // or some other derived type
std::streambuf* p = .....;
foo.ios::rdbuf(p); // ios == basic_ios<char>
References clear().
template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [nodiscard], [inherited]
Returns the error state of the stream buffer. ๐ฉบ
Returns
- a bit pattern (well, isn't everything? ๐)
See std::ios_base::iostate for the possible bit values โ that's where all the actual bits live. Most users will just call one of the interpreting wrappers, e.g., good().
Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().
void std::ios_base::register_callback (event_callback __fn, int __index) [inherited]
Add the callback __fn with parameter __index. ๐
Parameters
__fnโ the function to add.__indexโ the integer to pass to the function when invoked.
Registers a function as an event callback, with an integer parameter that gets passed to the function when it's invoked. Multiple copies of the function are allowed. And if there are multiple callbacks? They are invoked in the order they were registered โ first come, first served, no cutting the line. ๐ซถ
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. ๐ฆ
Parameters
__offโ a file offset object.__dirโ the direction in which to seek.
Returns
*this
If fail() is not true, it calls rdbuf()->pubseekoff(off,dir). If that function fails, it sets failbit. ๐
References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (pos_type __pos)
Changing the current write position. ๐ฆ (the pos_type version, bestie)
Parameters
__posโ a file position object.
Returns
*this
If fail() is not true, it calls rdbuf()->pubseekpos(pos). If that function fails, it sets failbit. ๐
References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().
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 โ nothing gets wiped, we're just adding. ๐
Referenced by std::__detail::operator>>().
fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited]
Setting new format flags. โญ (the two-argument glow-up)
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. ๐จ
Parameters
__stateโ the additional state flag(s) to set.
See std::ios_base::iostate for the possible bit values.
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), and std::ws().
bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]
Interaction with the standard C I/O objects. ๐
Parameters
__syncโ whether to synchronize or not.
Returns
- true if the standard streams were previously synchronized.
bestie, read this carefully: 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. ๐
Returns
- a file position object.
If fail() is not false, it returns pos_type(-1) to indicate failure. Otherwise it returns rdbuf()->pubseekoff(0,cur,out).
References std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::out, and std::basic_ios< _CharT, _Traits >::rdbuf().
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [nodiscard], [inherited]
Fetches the current tied stream. ๐
Returns
- a pointer to the tied stream, or
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. iconic behaviour, honestly. ๐
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and 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. ๐ชข
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. ๐งน
Parameters
__maskโ the flags to unset.
This function clears __mask in the format flags. bye girl, you're un-set. ๐
template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited]
Widens characters. ๐ฆ
Parameters
__cโ the character to widen.
Returns
- the widened character.
Maps a character of char to a character of char_type.
Returns the result of
std::use_facet<ctype<char_type> >(getloc()).widen(c)
Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
Referenced by std::endl(), std::basic_ios< char_type, traits_type >::fill(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::getline(), std::getline(), std::getline(), std::operator<<(), std::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::tr2::operator>>().
streamsize std::ios_base::width () const [inline], [nodiscard], [inherited]
Flags access. ๐
Returns
- the minimum field width to generate on output operations.
Minimum field width refers to the number of characters.
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
streamsize std::ios_base::width (streamsize __wide) [inline], [inherited]
Changing flags. โ๏ธ
Parameters
__wideโ the new width value.
Returns
- the previous value of
width().
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::write (const char_type * __s, streamsize __n)
Character string insertion. โ๏ธ
Parameters
__sโ the array to insert.__nโ maximum number of characters to insert.
Returns
*this
Characters are copied from __s and inserted into the stream until one of the following happens:
__ncharacters are inserted- inserting into the output sequence fails (in this case,
badbitwill be set in the stream's error state) ๐
Note: this function is not overloaded onsigned charandunsigned char. don't come for it, it's just built like that. ๐
int std::ios_base::xalloc () [static], [inherited]
Access to unique indices. ๐ข
Returns
- an integer different from all previous calls.
This function returns a unique integer every single time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. ๐ซถ
The implementation maintains a static variable that is incremented and returned on each invocation. xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays. periodt. ๐
โจ Member Data Documentation โจ
const fmtflags std::ios_base::adjustfield[static],[inherited]โ It's a mask made ofleft|right|internal. Super useful for the 2-arg form ofsetf, fr fr.
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 the end before each write. It's giving "always append" realness.
Referenced by std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
const openmode std::ios_base::ate[static],[inherited]โ Open and seek to the end immediately after opening. Lowkey the "jump to the end" vibe.
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 (like an irrecoverable read error from a file). This is the "something went terribly wrong" flag, bestie. Not cute.
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, char_traits< _CharT > >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
const fmtflags std::ios_base::basefield[static],[inherited]โ A mask ofdec|oct|hex. Perfect for the 2-arg form ofsetf, iykyk.
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. It's giving "start from the top" energy.
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). This is probably not what you think it is; seehttps://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().
const fmtflags std::ios_base::boolalpha[static],[inherited]โ Insert/extractboolin alphabetic rather than numeric format. Sotrue/falseinstead of1/0, bestie.
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. Main character energy: you stay where you are, just offset.
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 classic.
Referenced by std::dec(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.
const seekdir std::ios_base::end[static],[inherited]โ Request a seek relative to the current end of the sequence. It's giving "from the bottom" vibes.
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. Not me hitting EOF and feeling empty ๐ญ
Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, char_traits< _CharT > >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, char_traits< _CharT > >::seekg(), std::basic_istream< _CharT, _Traits >::unget(), std::basic_istream< _CharT, char_traits< _CharT > >::unget(), and std::ws().
const iostate std::ios_base::failbit[static],[inherited]โ Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. Basically "the vibe was off" flag. ๐
Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), and std::basic_ostream< _CharT, _Traits >::seekp().
const fmtflags std::ios_base::fixed[static],[inherited]โ Generate floating-point output in fixed-point notation. No scientific notation here, just straight-up decimals.
Referenced by std::fixed(), and std::hexfloat().
const fmtflags std::ios_base::floatfield[static],[inherited]โ A mask ofscientific|fixed. Useful for the 2-arg form ofsetf, periodt.
Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
const iostate std::ios_base::goodbit[static],[inherited]โ Indicates all is well. It's giving "no thoughts, just vibes" but for streams. โจ
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().
const fmtflags std::ios_base::hex[static],[inherited]โ Converts integer input or generates integer output in hexadecimal base. Base 16, for when you're feeling extra.
Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::hex().
const openmode std::ios_base::in[static],[inherited]โ Open for input. Default forifstreamandfstream, bestie.
okay so that last constant's referenced-by list was still going, and here's the whole rest of it โ every single entry, no skips, no cap:
std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_ifstream< char >::basic_ifstream()std::basic_ifstream< char >::basic_ifstream()std::basic_ifstream< char >::basic_ifstream()std::basic_istringstream< char >::basic_istringstream()std::basic_stringbuf< char >::basic_stringbuf()std::basic_stringstream< char >::basic_stringstream()std::basic_filebuf< char_type, traits_type >::_M_set_buffer()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_ifstream< char >::open()std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()std::basic_filebuf< _CharT, _Traits >::pbackfail()std::basic_streambuf< char_type, traits_type >::pubseekoff()std::basic_streambuf< char_type, traits_type >::pubseekpos()std::basic_istream< _CharT, _Traits >::seekg()std::basic_istream< _CharT, _Traits >::seekg()std::basic_streambuf< char_type, traits_type >::seekoff()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()std::basic_stringbuf< char >::seekoff()std::basic_streambuf< char_type, traits_type >::seekpos()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()std::basic_stringbuf< char >::seekpos()std::basic_filebuf< _CharT, _Traits >::showmanyc()std::basic_stringbuf< char >::showmanyc()std::basic_istream< _CharT, _Traits >::tellg()std::basic_filebuf< _CharT, _Traits >::underflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow()std::basic_filebuf< _CharT, _Traits >::xsgetn()
const fmtflags std::ios_base::internal[static],[inherited]โ drops the fill characters at a point inside the output that you specifically designateโฆ and if you never designate one, bestie, it behaves exactly likeright. Referenced by:std::internal()
const fmtflags std::ios_base::left[static],[inherited]โ pads with fill characters on the right (the final positions) of certain generated output. I.e. the thing you print is flush left. Referenced by:std::num_put< _CharT, _OutIter >::do_put()std::left()std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<
const fmtflags std::ios_base::oct[static],[inherited]โ converts integer input, or generates integer output, in octal base (that's base 8, queen). Referenced by:std::oct()
const openmode std::ios_base::out[static],[inherited]โ open for output. this one's the default forofstreamandfstream, so she's kinda the main character. Referenced by:std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_fstream< char >::basic_fstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ofstream< char >::basic_ofstream()std::basic_ostringstream< char >::basic_ostringstream()std::basic_stringbuf< char >::basic_stringbuf()std::basic_stringstream< char >::basic_stringstream()std::basic_filebuf< char_type, traits_type >::_M_set_buffer()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_fstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::basic_ofstream< char >::open()std::basic_filebuf< _CharT, _Traits >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail()std::basic_streambuf< char_type, traits_type >::pubseekoff()std::basic_streambuf< char_type, traits_type >::pubseekpos()std::basic_streambuf< char_type, traits_type >::seekoff()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()std::basic_stringbuf< char >::seekoff()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_ostream< _CharT, _Traits >::seekp()std::basic_streambuf< char_type, traits_type >::seekpos()std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()std::basic_stringbuf< char >::seekpos()std::basic_ostream< _CharT, _Traits >::tellp()std::basic_filebuf< _CharT, _Traits >::xsputn()
const fmtflags std::ios_base::right[static],[inherited]โ pads with fill characters on the left (the 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. very science-core of her ๐งช Referenced by:std::hexfloat()std::scientific()
const fmtflags std::ios_base::showbase[static],[inherited]โ generates a prefix that tells you the numeric base of generated integer output. Referenced by:std::num_put< _CharT, _OutIter >::do_put()std::noshowbase()std::showbase()
const fmtflags std::ios_base::showpoint[static],[inherited]โ generates a decimal-point character unconditionally in floating-point output. she said you're getting the point, periodt. Referenced by:std::noshowpoint()std::showpoint()
const fmtflags std::ios_base::showpos[static],[inherited]โ generates a+sign in non-negative generated numeric output. Referenced by:std::noshowpos()std::showpos()
const fmtflags std::ios_base::skipws[static],[inherited]โ skips leading white space before certain input operations. Referenced by:std::noskipws()std::__detail::operator>>()std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>std::skipws()
const openmode std::ios_base::trunc[static],[inherited]โ truncate an existing stream when opening. Default forofstream. no referenced-by list for this one, she's doing her own thing ๐const fmtflags std::ios_base::unitbuf[static],[inherited]โ flushes output after each output operation. yes, every single one, she does not wait. Referenced by:std::basic_ostream< _CharT, _Traits >::sentry::~sentry()std::nounitbuf()std::unitbuf()
const fmtflags std::ios_base::uppercase[static],[inherited]โ replaces certain lowercase letters with their uppercase equivalents in generated output. she's loud and she knows it ๐ฃ Referenced by:std::num_put< _CharT, _OutIter >::do_put()std::nouppercase()std::uppercase()
๐ AUTHOR
Generated automatically by Doxygen for libstdc++ from the source code.
and that's a wrap on the whole page, bestie!! ๐ this whole thing is a libstdc++ original, auto-generated by Doxygen straight from the source code, and it lives in section 3 of the manual as std::basic..., _Traits >(3) โ the footer date and version live down there in the fine print, so go peek if you need the exact stamp โจ now go forth and stream responsibly, you absolute icon ๐๐ฆ
๐ฆ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms