STD::OSTRINGSTREAM(3cxx)
๐ธ NAME ๐ธ
This is the page for std::basic_ostringstream< _CharT, _Traits, _Alloc > in the (3cxx) manual, bestie. Its whole job? Controlling output for std::string. That's the vibe, that's the mission. ๐
โจ SYNOPSIS โจ
#include <sstream>
Inherits std::basic_ostream< _CharT, _Traits >.
๐ Public Types ๐
The type-alias wardrobe is right here โ every single one, no skips:
typedef ctype< _CharT > __ctype_typeโ Listed with no extra note in the source.typedef basic_ios< _CharT, _Traits > __ios_typeโ Listed with no extra note in the source.typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_typeโ Listed with no extra note in the source.typedef basic_ostream< char_type, traits_type > __ostream_typeโ Listed with no extra note in the source.typedef basic_streambuf< _CharT, _Traits > __streambuf_typeโ Listed with no extra note in the source.typedef basic_string< _CharT, _Traits, _Alloc > __string_typeโ Listed with no extra note in the source.typedef basic_stringbuf< _CharT, _Traits, _Alloc > __stringbuf_typeโ Listed with no extra note in the source.typedef _Alloc allocator_typeโ Listed with no extra note in the source.typedef _CharT char_typeโ Listed with no extra note in the source.enum event { erase_event, imbue_event, copyfmt_event }โ The set of events that may be passed to an event callback.typedef void(* event_callback) (event __e, ios_base &__b, int __i)โ The type of an event callback function.typedef _Ios_Fmtflags fmtflagsโ This is a bitmask type.typedef traits_type::int_type int_typeโ Listed with no extra note in the source.typedef _Ios_Iostate iostateโ This is a bitmask type.typedef traits_type::off_type off_typeโ Listed with no extra note in the source.typedef _Ios_Openmode openmodeโ This is a bitmask type.typedef traits_type::pos_type pos_typeโ Listed with no extra note in the source.typedef _Ios_Seekdir seekdirโ This is an enumerated type.typedef _Traits traits_typeโ Listed with no extra note in the source.typedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_typeโ Listed with no extra note in the source.
๐ Public Member Functions ๐
Okay, here's the full member-function lineup, in order, no disappearing acts:
basic_ostringstream ()โ Default constructor starts with an empty string buffer.basic_ostringstream (basic_ostringstream &&__rhs)โ Listed with no extra note in the source.basic_ostringstream (const __string_type &__str, ios_base::openmode __mode=ios_base::out)โ Starts with an existing string buffer.basic_ostringstream (const basic_ostringstream &)=deleteโ Listed as=delete; no extra note in the source.basic_ostringstream (ios_base::openmode __mode)โ Starts with an empty string buffer.~basic_ostringstream ()โ The destructor does nothing. Literally nothing. Iconic.const locale & _M_getloc () constโ Locale access.template<typename _ValueT > basic_ostream< _CharT, _Traits > & _M_insert (_ValueT __v)โ Listed with no extra note in the source.void _M_setstate (iostate __state)โ Listed with no extra note in the source.bool bad () constโ Fast error checking.void clear (iostate __state=goodbit)โ [Re]sets the error state.basic_ios & copyfmt (const basic_ios &__rhs)โ Copies fields of__rhsinto this.bool eof () constโ Fast error checking.iostate exceptions () constโ Throwing exceptions on errors.void exceptions (iostate __except)โ Throwing exceptions on errors.bool fail () constโ Fast error checking.char_type fill () constโ Retrieves the empty character.char_type fill (char_type __ch)โ Sets a new empty character.fmtflags flags () constโ Access to format flags.fmtflags flags (fmtflags __fmtfl)โ Setting new format flags all at once.__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)โ Listed with no extra note in the source.basic_ostringstream & operator= (basic_ostringstream &&__rhs)โ Listed with no extra note in the source.basic_ostringstream & operator= (const basic_ostringstream &)=deleteโ Listed as=delete; no extra note in the source.streamsize precision () constโ Flags access.streamsize precision (streamsize __prec)โ Changing flags.void *& pword (int __ix)โ Access to void pointer array.__stringbuf_type * 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.__string_type str () constโ Copying out the string buffer.void str (const __string_type &__s)โ Setting a new buffer.void swap (basic_ostringstream &__rhs)โ Listed with no extra note in the source.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.basic_string_view< char_type, traits_type > view () const noexceptโ Listed with no extra note in the source.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 ๐ฅ
Okay so every single operator<< function โ aka every formatted output function โ has the same opening act. Each one starts by constructing a temporary object of type std::basic_ostream::sentry. That little icon can have several effects, and it finishes up by setting a status flag. See the sentry documentation for more tea. ๐ซถ
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. Then the original exception is rethrown. Periodt. ๐
__ostream_type & operator<< (long __n)โ Integer arithmetic inserter.__ostream_type & operator<< (unsigned long __n)โ Integer arithmetic inserter.__ostream_type & operator<< (bool __n)โ Integer arithmetic inserter.__ostream_type & operator<< (short __n)โ Integer arithmetic inserter.__ostream_type & operator<< (unsigned short __n)โ Integer arithmetic inserter.__ostream_type & operator<< (int __n)โ Integer arithmetic inserter.__ostream_type & operator<< (unsigned int __n)โ Integer arithmetic inserter.__ostream_type & operator<< (long long __n)โ Integer arithmetic inserter.__ostream_type & operator<< (unsigned long long __n)โ Integer arithmetic inserter.__ostream_type & operator<< (double __f)โ Floating point arithmetic inserter.__ostream_type & operator<< (float __f)โ Floating point arithmetic inserter.__ostream_type & operator<< (long double __f)โ Floating point arithmetic inserter.
๐ฆ Unformatted Output Functions ๐ฆ
All the unformatted output functions share some behavior, bestie. Each one starts by constructing a temporary object of type std::basic_ostream::sentry. This has several effects, and it concludes 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. That's the warning, don't skip it. ๐
__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 โจ
static const openmode __noreplaceโ bestie, the docs literally just list this one with no description attached. No cap.static const fmtflags adjustfieldโ it's the maskleft|right|internal, and it's useful for the 2-arg form ofsetf.static const openmode appโ seek to the end before every single write.static const openmode ateโ open it, then immediately seek to the end right after opening.static const iostate badbitโ this one means a loss of integrity in an input or output sequence happened โ like an irrecoverable read error from a file. It's giving "something is deeply wrong."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). And bestie, 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 format instead of 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. The vibes are immaculate.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 it's 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 }โ a tiny protected enum with exactly one member, bestie, and that's the whole list.
๐ Protected Member Functions ๐
void _M_cache_locale (const locale &__loc)โ the internal locale-caching hook.void _M_call_callbacks (event __ev) throw ()โ the internal callback-calling hook.void _M_dispose_callbacks (void) throw ()โ the internal callback-disposal hook._Words & _M_grow_words (int __index, bool __iword)โ the internal word-growing hook.void _M_init () throw ()โ the internal init hook.template<typename _ValueT > __ostream_type & _M_insert (_ValueT __v)โ the internal insert hook.void _M_move (ios_base &) noexceptโ the internal move hook forios_base.void _M_swap (ios_base &__rhs) noexceptโ the internal swap hook forios_base.void init (basic_streambuf< _CharT, _Traits > *__sb)โ all setup is performed here.void move (basic_ios &&__rhs)โ move from abasic_iosrvalue reference.void move (basic_ios &__rhs)โ move from abasic_ioslvalue reference.void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)โ the protectedset_rdbufhook.void swap (basic_ios &__rhs) noexceptโ swap with anotherbasic_ios.void swap (basic_ostream &__rhs)โ swap with abasic_ostream.
๐งบ Protected Attributes ๐งบ
_Callback_list * _M_callbacksโ callback list pointer.const __ctype_type * _M_ctypeโ the cached ctype facet pointer.iostate _M_exceptionโ the exception-state mask.char_type _M_fillโ the fill character.bool _M_fill_initโ fill-character initialization flag.fmtflags _M_flagsโ the formatting flags.locale _M_ios_localeโ the locale object._Words _M_local_word [_S_local_word_size]โ the local word array.const __num_get_type * _M_num_getโ the cached numeric-get facet pointer.const __num_put_type * _M_num_putโ the cached numeric-put facet pointer.streamsize _M_precisionโ the precision value.basic_streambuf< _CharT, _Traits > * _M_streambufโ the streambuf pointer.iostate _M_streambuf_stateโ the streambuf state.basic_ostream< _CharT, _Traits > * _M_tieโ the tied output stream pointer.streamsize _M_widthโ the width value._Words * _M_wordโ the word pointer.int _M_word_sizeโ the word count._Words _M_word_zeroโ the zero word.
๐ Detailed Description ๐
template<typename _CharT, typename _Traits, typename _Alloc>
class std::basic_ostringstream< _CharT, _Traits, _Alloc >
Okay so this class is literally described as "Controlling output for std::string." Iconic behavior.
Template Parameters
_CharTโ type of character stream._Traitsโ traits for character type, defaults tochar_traits<_CharT>._Allocโ allocator type, defaults toallocator<_CharT>.
This class supports writing to objects of type std::basic_string, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.
๐ท๏ธ Member Typedef Documentation ๐ท๏ธ
๐ซถ __num_get_type (inherited) ๐ซถ
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. The docs said it, not me.
๐๏ธ event_callback (inherited) ๐๏ธ
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 (inherited) ๐ง
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 (inherited) ๐ฆ
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 (inherited) ๐
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 (inherited) โญ
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) ๐
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_ostringstream() [inline] ๐ฑ
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream () [inline]
Default constructor starts with an empty string buffer. Initializes sb using mode|out, and passes &sb to the base class initializer. Does not allocate any buffer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
References std::basic_ios< _CharT, _Traits >::init().
๐ธ basic_ostringstream(ios_base::openmode __mode) [inline], [explicit] ๐ธ
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream (ios_base::openmode __mode) [inline], [explicit]
Starts with an empty string buffer.
Parameters
__modeโ whether the buffer can read, or write, or both.
ios_base::out is automatically included in mode.
Initializes sb using mode|out, and passes &sb to the base class initializer. Does not allocate any buffer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
References std::basic_ios< _CharT, _Traits >::init().
๐ฆ basic_ostringstream(const __string_type & __str, ios_base::openmode __mode = ios_base::out) [inline], [explicit] ๐ฆ
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream (const __string_type & __str, ios_base::openmode __mode = ios_base::out) [inline], [explicit]
Starts with an existing string buffer.
Parameters
__strโ a string to copy as a starting buffer.__modeโ whether the buffer can read, or write, or both.
ios_base::out is automatically included in mode.
Initializes sb using str and mode|out, and passes &sb to the base class initializer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
References std::basic_ios< _CharT, _Traits >::init().
๐ ~basic_ostringstream() [inline] ๐
template<typename _CharT , typename _Traits , typename _Alloc > std::basic_ostringstream< _CharT, _Traits, _Alloc >::~basic_ostringstream () [inline]
The destructor does nothing. The buffer is deallocated by the stringbuf object, not the formatting stream.
๐งฐ Member Function Documentation ๐งฐ
๐ std::ios_base::_M_getloc() const [inline], [inherited] ๐
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 (tail end of that previous entry): std::money_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [inherited]
Bestie, this is your fast error check era. It returns true if the badbit is set.
Heads up: otheriostateflags may also be set, so donโt read this as โonlybadbitand nothing else, periodt.โ
- References:
std::ios_base::badbit, andstd::basic_ios< _CharT, _Traits >::rdstate(). - Referenced by:
std::basic_ostream< _CharT, _Traits >::sentry::sentry().
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]
This one [re]sets the error state. Very โreset the vibeโ of it all.
- Parameters:
__stateโ the new state flag(s) to set.
See std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument.
- Referenced by:
std::basic_ios< _CharT, _Traits >::exceptions(),std::basic_ifstream< _CharT, _Traits >::open(),std::basic_fstream< _CharT, _Traits >::open(),std::basic_ofstream< _CharT, _Traits >::open(),std::basic_ifstream< _CharT, _Traits >::open(),std::basic_fstream< _CharT, _Traits >::open(),std::basic_ofstream< _CharT, _Traits >::open(),std::__detail::operator>>(),std::basic_istream< _CharT, _Traits >::putback(),std::basic_istream< _CharT, _Traits >::seekg(),std::basic_istream< _CharT, _Traits >::seekg(),std::basic_ios< _CharT, _Traits >::setstate(), andstd::basic_istream< _CharT, _Traits >::unget().
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 โclone the formatting, not the actual stream state.โ
- Parameters:
__rhsโ the source values for the copies. - Returns: reference to this object.
All fields of __rhs are copied into this object except that rdbuf() and rdstate() remain unchanged. All values in the pword and iword arrays are copied. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions().
- References:
std::__addressof(),std::basic_ios< _CharT, _Traits >::exceptions(),std::basic_ios< _CharT, _Traits >::fill(),std::ios_base::flags(),std::ios_base::getloc(),std::ios_base::precision(),std::basic_ios< _CharT, _Traits >::tie(),std::tie(), andstd::ios_base::width().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [inherited]
Fast error checking, but make it end-of-file coded.
- Returns:
trueif theeofbitis set.
Note: other iostate flags may also be set.
- References:
std::ios_base::eofbit, andstd::basic_ios< _CharT, _Traits >::rdstate().
template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [inherited]
Throwing exceptions on errors โ this is the getter version.
- Returns: the current exceptions mask.
This changes nothing in the stream. See the one-argument version of exceptions(iostate) for the meaning of the return value.
- Referenced by:
std::basic_ios< _CharT, _Traits >::copyfmt().
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline], [inherited]
Throwing exceptions on errors โ now with setter energy.
- Parameters:
__exceptโ the new exceptions mask.
By default, error flags are set silently. You can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown.
If the error flag is already set when the exceptions mask is added, the exception is immediately thrown. Try running the following under GCC 3.1 or later:
#include <iostream>
#include <fstream>
#include <exception>
int main()
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
std::ifstream f ("/etc/motd");
std::cerr << "Setting badbit\n";
f.setstate (std::ios_base::badbit);
std::cerr << "Setting exception mask\n";
f.exceptions (std::ios_base::badbit);
}
- References:
std::basic_ios< _CharT, _Traits >::clear().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [inherited]
Fast error checking, but this one is a little messy on purpose.
- Returns:
trueif either thebadbitor thefailbitis set.
Checking the badbit in fail() is historical practice. Note that other iostate flags may also be set.
- References:
std::ios_base::badbit,std::ios_base::failbit, andstd::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(), andstd::regex_traits< _Ch_type >::value().
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [inherited]
Retrieves the empty character. The filler character. The padding bestie.
- Returns: the current fill character.
It defaults to a space (' ') in the current locale.
- References:
std::basic_ios< _CharT, _Traits >::widen(). - Referenced by:
std::basic_ios< _CharT, _Traits >::copyfmt(), andstd::basic_ios< _CharT, _Traits >::fill().
template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill (char_type __ch) [inline], [inherited]
Sets a new empty character. Slay, new padding character acquired.
- Parameters:
__chโ the new character. - Returns: the previous fill character.
The fill character is used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale.
- References:
std::basic_ios< _CharT, _Traits >::fill().
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>>(), andstd::operator>>().
fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]
Setting new format flags all at once. Itโs the โreplace the whole fitโ of format flags.
- Parameters:
__fmtflโ the new flags to set. - Returns: the previous format control flags.
This function overwrites all the format flags with __fmtfl.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush () [inherited]
Synchronizing the stream buffer. Push the vibe out, bestie.
- Returns:
*this
If rdbuf() is a null pointer, changes nothing.
Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit.
- References:
std::ios_base::badbit,std::ios_base::goodbit,std::basic_ios< _CharT, _Traits >::rdbuf(), andstd::basic_ios< _CharT, _Traits >::setstate(). - Referenced by:
std::flush().
locale std::ios_base::getloc () const [inline], [inherited]
Locale access. Very โwhatโs the current localization situationโ of it all.
- Returns: a copy of the current locale.
If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale.
- Referenced by:
std::basic_ios< _CharT, _Traits >::copyfmt(),std::money_put< _CharT, _OutIter >::do_put(),std::chrono::operator<<(),std::operator>>(),std::operator>>(), andstd::ws().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::good () const [inline], [inherited]
Fast error checking, but make it unbothered.
- Returns:
trueif no error flags are set.
A wrapper around rdstate.
- References:
std::basic_ios< _CharT, _Traits >::rdstate(). - Referenced by:
std::basic_istream< _CharT, _Traits >::sentry::sentry(),std::basic_ostream< _CharT, _Traits >::sentry::sentry(), andstd::__detail::operator>>().
template<typename _CharT , typename _Traits > locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]
Moves to a new locale. Locale glow-up, if you will.
- Parameters:
__locโ the new locale. - Returns: the previous locale.
Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that bufferโs pubimbue(loc).
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
- References:
std::ios_base::imbue(). - Referenced by:
std::chrono::operator<<().
template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]
All setup is performed here. This is called from the public constructor. It is not virtual and cannot be redefined.
okay so before we move on, hereโs the โจreferenced byโจ list for that constructor โ literally every single one, no cap:
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()std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream()
long & std::ios_base::iword (int __ix) [inline], [inherited]โ access to the integer array, bestie ๐งฎ
Parameters: __ix โ index into the array.
Returns: a reference to an integer associated with the index.
the iword function provides access to an array of integers that can be used for any purpose. the array grows as required to hold the supplied index. all integers in the array are initialized to 0.
the implementation reserves several indices. you should use xalloc to obtain an index that is safe to use. also note that since the array can grow dynamically, it is not safe to hold onto the reference. ๐ญ
template<typename _CharT , typename _Traits > char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]โ squeezes characters ๐
Parameters:
__cโ the character to narrow.__dfaultโ the character to narrow.
Returns: the narrowed character.
maps a character of char_type to a character of char, if possible.
returns the result of
std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html โ iykyk ๐
template<typename _CharT , typename _Traits > std::basic_ios< _CharT, _Traits >::operator bool () const [inline], [explicit], [inherited]โ the quick-and-easy status check โ
this allows you to write constructs such as if (!a_stream) ... and while (a_stream) ...
References: std::basic_ios< _CharT, _Traits >::fail().
template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::operator! () const [inline], [inherited]โ the quick-and-easy status check, but with a!๐
this allows you to write constructs such as if (!a_stream) ... and while (a_stream) ...
References: std::basic_ios< _CharT, _Traits >::fail().
the operator<< era โ literally so many inserters, hold my matcha ๐ต
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (__ios_type &(*)(__ios_type &) __pf) [inline], [inherited]โ 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<< (__ostream_type &(*)(__ostream_type &) __pf) [inline], [inherited]โ interface for manipulators (the other flavor) ๐๏ธ
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) [inherited]โ extracting from another streambuf, no cap ๐ซถ
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], [inherited]โ integer arithmetic inserters ๐ข
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (const void * __p) [inline], [inherited]โ pointer arithmetic inserters ๐งท
Parameters: __p โ a variable of pointer type.
Returns: *this if 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], [inherited]โ floating point arithmetic inserters ๐ง
Parameters: __f โ a variable of builtin floating point type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (float __f) [inline], [inherited]โ floating point arithmetic inserters (thefloatone) ๐
Parameters: __f โ a variable of builtin floating point type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (int __n) [inherited]โ integer arithmetic inserters (theintone) ๐
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (ios_base &(*)(ios_base &) __pf) [inline], [inherited]โ interface for manipulators (theios_baseone) ๐๏ธ
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], [inherited]โ integer arithmetic inserters (thelongone) ๐
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long double __f) [inline], [inherited]โ floating point arithmetic inserters (thelong doubleone) ๐
Parameters: __f โ a variable of builtin floating point type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long long __n) [inline], [inherited]โ integer arithmetic inserters (thelong longone) ๐ฆ
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (short __n) [inherited]โ integer arithmetic inserters (theshortone) ๐ฉณ
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
References: std::ios_base::badbit, std::ios_base::goodbit, and std::basic_ios< _CharT, _Traits >::setstate().
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned int __n) [inline], [inherited]โ integer arithmetic inserters (theunsigned intone) ๐
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long __n) [inline], [inherited]โ integer arithmetic inserters (theunsigned longone) ๐
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long long __n) [inline], [inherited]โ integer arithmetic inserters (theunsigned long longone) ๐ซ
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (unsigned short __n) [inline], [inherited]โ integer arithmetic inserters (theunsigned shortone) ๐
Parameters: __n โ a variable of builtin integral type.
Returns: *this if successful.
these functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.
streamsize std::ios_base::precision () const [inline], [inherited]โ flags access ๐
Returns: the precision to generate on certain output operations.
โ ๏ธ okay but be careful if you try to give a definition of precision here โ see DR 189. Not me warning you, that's the docs ๐
Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().
streamsize std::ios_base::precision(streamsize __prec) [inline], [inherited] โ changing flags, precision edition โจ
Parameters:
__precโ the new precision value ๐๏ธ
Returns: the previous value of precision(). Like, you hand it the new number and it hands you back the old one โ a little exchange ๐ซถ
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::put(char_type __c) [inherited] โ simple insertion ๐ธ
Parameters:
__cโ the character to insert โ๏ธ
Returns: *this
Tries to insert __c. That's the whole vibe ๐ซ
๐ Note: this function is not overloaded onsigned charandunsigned char. iykyk ๐
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().
void *& std::ios_base::pword(int __ix) [inline], [inherited] โ access to the void pointer array ๐ฆ
Parameters:
__ixโ index into the array ๐ข
Returns: a reference to a void* associated with the index ๐ฏ
The pword function gives you access to an array of pointers you can use for literally any purpose. The array grows as required to hold the supplied index, main character energy fr fr. All pointers in the array are initialized to 0 ๐
๐จ The implementation reserves several indices. You should use xalloc to obtain an index that's safe to use. Also note: since the array can grow dynamically, it's not safe to hold onto the reference. Don't get attached, bestie ๐ญ
template<typename _CharT, typename _Traits, typename _Alloc> __stringbuf_type * std::basic_ostringstream< _CharT, _Traits, _Alloc >::rdbuf() const [inline] โ accessing the underlying buffer ๐
Returns: the current basic_stringbuf buffer ๐ฆ
This hides both signatures of std::basic_ios::rdbuf(). Sneaky but iconic ๐
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 ๐
Parameters:
__sbโ the new stream buffer ๐งบ
Returns: the previous stream buffer ๐
Associates a new buffer with the current stream, and clears the error state โจ
๐ 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 ๐ฉบ
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(). That's the move, ngl ๐
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 ๐
Parameters:
__fnโ the function to add ๐งฉ__indexโ the integer to pass to the function when invoked ๐๏ธ
Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered โ first come, first served, periodt ๐
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp(off_type __off, ios_base::seekdir __dir) [inherited] โ 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, 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) [inherited] โ changing the current write position, the pos_type remix ๐
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 ๐๏ธ
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 love a non-destructive queen ๐
Referenced by std::__detail::operator>>().
fmtflags std::ios_base::setf(fmtflags __fmtfl, fmtflags __mask) [inline], [inherited] โ setting new format flags, now with a mask ๐ญ
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. Cute little clear-then-set combo ๐ซ
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.
References std::basic_ios< _CharT, _Traits >::clear(), and std::basic_ios< _CharT, _Traits >::rdstate().
Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ifstream< _CharT, _Traits >::close(), std::basic_ofstream< _CharT, _Traits >::close(), std::basic_fstream< _CharT, _Traits >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), and std::ws(). (yes that's a LOT of friends, she's booked and busy ๐ญ๐ฅ)
template<typename _CharT, typename _Traits, typename _Alloc> __string_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::str() const [inline] โ copying out the string buffer ๐ค
Returns: rdbuf()->str() ๐
That's it. That's the whole function. Short and slay โจ
template<typename _CharT, typename _Traits, typename _Alloc> void std::basic_ostringstream< _CharT, _Traits, _Alloc >::str(const __string_type & __s) [inline] โ setting a new buffer ๐ฅ
Parameters:
__sโ the string to use as a new sequence ๐ค
Calls rdbuf()->str(s). Fresh content, who dis ๐ฆ
static bool std::ios_base::sync_with_stdio(bool __sync = true) [static], [inherited] โ interaction with the standard C I/O objects ๐
Parameters:
__syncโ whether to synchronize or not ๐
Returns: true if the standard streams were previously synchronized โ
The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary ๐
template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp() [inherited] โ getting the current write position ๐
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 ๐ชข
Returns: a pointer to the tied stream, or NULL if 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. Bestie behavior honestly ๐ซถ
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 ๐
Parameters:
__tiestrโ the output stream ๐งต
Returns: the previously tied output stream, or NULL if the stream was not tied ๐
This sets up a new tie; see tie() for more. It's giving linked-up besties โจ
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 bye flags, you had a good run ๐
๐ธ widen โ the char-to-char_type glow-up โจ
template<typename _CharT , typename _Traits > char_type std::basic_ios<
_CharT, _Traits >::widen (char __c) const [inline], [inherited]
Widens characters. Like, it takes a lil baby char and gives it the full char_type treatment ๐
Parameters
__cโ the character to widen, bestie.
Returns
The widened character. Iconic.
It maps a character of char to a character of char_type, and it literally returns the result of:
std::use_facet<ctype<char_type> >(getloc()).widen(c)
Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html โ go read up, iykyk ๐ฆ
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>>().
๐ width (the getter) โ flags access, no cap
streamsize std::ios_base::width () const [inline], [inherited]
Flags access. She's just here to tell you the tea โ
Returns
The minimum field width to generate on output operations.
Minimum field width refers to the number of characters โ that's it, that's the whole vibe.
Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().
๐ width (the setter) โ changing flags, main character energy
streamsize std::ios_base::width (streamsize __wide) [inline], [inherited]
Changing flags.</purpose> โ set that width, bestie.
Parameters
__wideโ the new width value.
Returns
The previous value of width(). Not me returning the old one before switching up the fit ๐ญ that's so it can be restored later, fr fr.
๐ฅ write โ character string insertion
template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits
> & std::basic_ostream< _CharT, _Traits >::write (const char_type * __s,
streamsize __n) [inherited]
Parameters
__sโ the array to insert.__nโ maximum number of characters to insert. Cap it, periodt.
Returns
*this โ she returns herself, queen behaviour ๐
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 โ and in that case,
badbitwill be set in the stream's error state ๐
Note: This function is not overloaded onsigned charandunsigned char. So don't come for her with those, she's not doing it ๐
โญ xalloc โ access to unique indices
static int std::ios_base::xalloc () [static], [inherited]
Returns
An integer different from all previous calls. Every single time. No repeats, no reruns ๐ซ
This function returns a unique integer every time it is called. It can be used for any purpose, but is primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. Conflict-free index? We love to see it ๐ซถ
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. Guaranteed. Slay.
๐ Member Data Documentation ๐
Okay bestie, this section is the static-constant hall of fame. All of these are [static] and [inherited], and they're the lore behind all those flag functions you've been calling. Buckle up ๐ข
๐ธ adjustfield โ the mask of left|right|internal
const fmtflags std::ios_base::adjustfield [static], [inherited]
A mask of left|right|internal. Useful for the 2-arg form of setf. That's the whole vibe check โ
Referenced by: std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().
๐ app โ seek to end before each write
const openmode std::ios_base::app [static], [inherited]
Seek to end before each write. Every. Single. Write. Append mode stays appending, periodt ๐
Referenced by: std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
๐ฆ ate โ the "open then immediately yeet to the end" one
const openmode std::ios_base::ate [static], [inherited]
Open and seek to end immediately after opening. Not before each write like app โ just once, right after opening. Iykyk, they're different ๐
Referenced by: std::basic_filebuf< _CharT, _Traits >::open().
๐ badbit โ loss of integrity, not a drill
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). Like, the stream is not okay. Irrecoverable. So serious ๐ญ
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().
๐บ basefield โ the mask of dec|oct|hex
const fmtflags std::ios_base::basefield [static], [inherited]
A mask of dec|oct|hex. Useful for the 2-arg form of setf. Number-base flags, all bundled up ๐
Referenced by: std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().
๐ง beg โ seek from the beginning, obviously
const seekdir std::ios_base::beg [static], [inherited]
Request a seek relative to the beginning of the stream. The origin story โจ
Referenced by: std::basic_filebuf< _CharT, _Traits >::seekpos().
๐ binary โ read the note, bestie, please
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; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
Fr though, go read that link. She said "probably not what you think" for a reason โ don't assume, it's giving trap ๐
Referenced by: std::basic_filebuf< _CharT, _Traits >::showmanyc().
๐ boolalpha โ bool but make it letters
const fmtflags std::ios_base::boolalpha [static], [inherited]
Insert/extract bool in alphabetic rather than numeric format. So true/false instead of 1/0. Way more readable, honestly ๐
Referenced by: std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().
๐ฆ cur โ seek from where we're at rn
const seekdir std::ios_base::cur [static], [inherited]
Request a seek relative to the current position within the sequence. Main character position, if you will ๐
Referenced by: std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().
๐ข dec โ decimal, babe
const fmtflags std::ios_base::dec [static], [inherited]
Converts integer input or generates integer output in decimal base. Base 10 supremacy ๐
Referenced by: std::dec().
๐ end โ seek from the end
const seekdir std::ios_base::end [static], [inherited]
Request a seek relative to the current end of the sequence. Tail end, literally ๐ธ
Referenced by: std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().
โญ eofbit โ you hit the end, congrats
const iostate std::ios_base::eofbit [static], [inherited]
Indicates that an input operation reached the end of an input sequence. That's the whole thing. The end. Literally ๐ซถ
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().
๐ญ failbit โ read failed, output failed, vibes failed
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. Both directions can betray you ๐
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().
๐ fixed โ fixed-point notation era
const fmtflags std::ios_base::fixed [static], [inherited]
Generate floating-point output in fixed-point notation. No scientific silliness here โจ
Referenced by: std::fixed(), and std::hexfloat().
๐ floatfield โ the mask of scientific|fixed
const fmtflags std::ios_base::floatfield [static], [inherited]
A mask of scientific|fixed. Useful for the 2-arg form of setf. Yes, this is the one that gives you defaultfloat, fixed, hexfloat and scientific โ she's the blueprint ๐
Referenced by: std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().
๐ goodbit โ all is well, bestie
const iostate std::ios_base::goodbit [static], [inherited]
Indicates all is well. That's it. That's the whole mood. Zero problems, stream is thriving, we love a healthy state ๐ซถโจ
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]
Okay so hex is giving โweโre doing hexadecimal nowโ energy. It converts integer input or generates integer output in hexadecimal base. Periodt. ๐
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]
in is literally the โopen for inputโ vibe. Itโs the default for ifstream and fstream. No cap. ๐ซถ
Referenced by: std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_filebuf< _CharT, _Traits >::showmanyc(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::showmanyc(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow(), and std::basic_filebuf< _CharT, _Traits >::xsgetn().
const fmtflags std::ios_base::internal [static], [inherited]
internal adds fill characters at a designated internal point in certain generated output, or itโs identical to right if no such point is designated. Itโs giving โI have a specific spot in mindโ energy. โจ
Referenced by: std::internal().
const fmtflags std::ios_base::left [static], [inherited]
left adds fill characters on the right (final positions) of certain generated output. I.e., the thing you print is flush left. Slay. ๐
Referenced by: std::num_put< _CharT, _OutIter >::do_put(), and std::left().
const fmtflags std::ios_base::oct [static], [inherited]
oct converts integer input or generates integer output in octal base. Eight is great, bestie. ๐
Referenced by: std::oct().
const openmode std::ios_base::out [static], [inherited]
out is the โopen for outputโ icon. Default for ofstream and fstream. You know the vibe. ๐
Referenced by: std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
const fmtflags std::ios_base::right [static], [inherited]
right adds fill characters on the left (initial positions) of certain generated output. I.e., the thing you print is flush right. Main character energy. ๐
Referenced by: std::right().
const fmtflags std::ios_base::scientific [static], [inherited]
scientific generates floating-point output in scientific notation. Itโs giving โIโm a scientistโ realness. ๐ฌ
Referenced by: std::hexfloat(), and std::scientific().
const fmtflags std::ios_base::showbase [static], [inherited]
showbase generates a prefix indicating the numeric base of generated integer output. So you know itโs hex or octal, periodt. ๐
Referenced by: std::num_put< _CharT, _OutIter >::do_put(), std::noshowbase(), and std::showbase().
const fmtflags std::ios_base::showpoint [static], [inherited]
showpoint generates a decimal-point character unconditionally in generated floating-point output. Even if itโs not needed? Yes bestie, itโs extra like that. ๐
Referenced by: std::noshowpoint(), and std::showpoint().
const fmtflags std::ios_base::showpos [static], [inherited]
showpos generates a + sign in non-negative generated numeric output. Positive vibes only. ๐ธ
Referenced by: std::noshowpos(), and std::showpos().
const fmtflags std::ios_base::skipws [static], [inherited]
skipws skips leading white space before certain input operations. Itโs the โno thanks to your spacesโ flag. ๐
Referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::noskipws(), std::__detail::operator>>(), and std::skipws().
const openmode std::ios_base::trunc [static], [inherited]
trunc truncates an existing stream when opening. Default for ofstream. Itโs giving โclean slateโ energy. No referenced-by for this one, sheโs independent. ๐ฆ
const fmtflags std::ios_base::unitbuf [static], [inherited]
unitbuf flushes output after each output operation. Like, every single time. Obsessed with being up-to-date. ๐ฅ
Referenced by: std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().
const fmtflags std::ios_base::uppercase [static], [inherited]
uppercase replaces certain lowercase letters with their uppercase equivalents in generated output. GLOW UP. โจ
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. So you know itโs official. ๐
๐ thatโs the whole vibe check, bestie! this page came from the libstdc++ source (auto-generated by Doxygen, no cap) and the date is chillinโ in the footer. section 3cxx, you know the drill. stay slay and keep your streams flush! ๐
โจ
๐ฆ 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