STD::OSTREAM(3cxx)

✨ NAME ✨

okay so manual name: 3cxx, and the header title up top is std::basic_ost...harT, _Traits >(3cxx) β€” but the actual main-character template we're talking about is std::basic_ostream< _CharT, _Traits >.

std::basic_ostream< _CharT, _Traits > β€” Template class basic_ostream. periodt, that's the name section, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <ostream>

Inherits std::basic_ios< _CharT, _Traits >.

Inherited by std::basic_iostream< char >, std::basic_iostream< _CharT, _Traits >, std::basic_ofstream< _CharT, _Traits >, and std::basic_ostringstream< _CharT, _Traits, _Alloc >.

so yeah bestie, it inherits from std::basic_ios< _CharT, _Traits >, and the whole nepo-baby lineup that inherits from it is right there: std::basic_iostream< char >, std::basic_iostream< _CharT, _Traits >, std::basic_ofstream< _CharT, _Traits >, and std::basic_ostringstream< _CharT, _Traits, _Alloc > πŸ¦‹

πŸŽ€ Classes πŸŽ€

  • class sentry β€” Performs setup work for output streams. literally the little pre-game routine for your stream, iconic

πŸ¦‹ Public Types πŸ¦‹

  • typedef ctype< _CharT > __ctype_type β€” a whole typedef, just existing and slaying
  • typedef basic_ios< _CharT, _Traits > __ios_type β€” the basic_ios type, wrapped up with a bow πŸŽ€
  • typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_type β€” yes bestie, every character is in its place
  • typedef basic_ostream< _CharT, _Traits > __ostream_type β€” the ostream type itself, main character energy
  • typedef basic_streambuf< _CharT, _Traits > __streambuf_type β€” streambuf type, underneath it all
  • typedef _CharT char_type β€” the character type, that's the _CharT vibe
  • enum event { erase_event, imbue_event, copyfmt_event } β€” The set of events that may be passed to an event callback. all three events are here, not one is missing
  • 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_type β€” the int_type typedef, no extra description on the page, just vibes
  • typedef _Ios_Iostate iostate β€” This is a bitmask type.
  • typedef _Traits::off_type off_type β€” off_type, sitting there looking pretty
  • typedef _Ios_Openmode openmode β€” This is a bitmask type.
  • typedef _Traits::pos_type pos_type β€” pos_type, another icon
  • typedef _Ios_Seekdir seekdir β€” This is an enumerated type.
  • typedef _Traits traits_type β€” the traits type, periodt
  • typedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_type β€” this one shows up right after traits_type in the original layout, so we are keeping it right here, bestie 🫢

🧚 Public Member Functions 🧚

okay deep breath, this is the big one. every single signature is staying, no skipping, no "you get the idea" behavior β€” we do not do that here πŸ’…

  • basic_ostream (__streambuf_type *__sb) β€” Base constructor.
  • virtual ~basic_ostream () β€” Base destructor.
  • const locale & _M_getloc () const β€” Locale access.
  • template<typename _ValueT > basic_ostream< _CharT, _Traits > & _M_insert (_ValueT __v) β€” signature only, no extra description on the page
  • void _M_setstate (iostate __state) β€” signature only, no extra description on the page
  • 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 __rhs into this.
  • bool eof () const β€” Fast error checking.
  • iostate exceptions () const β€” Throwing exceptions on errors.
  • void exceptions (iostate __except) β€” Throwing exceptions on errors.
  • bool fail () const β€” Fast error checking.
  • char_type fill () const β€” Retrieves the empty character.
  • char_type fill (char_type __ch) β€” Sets a new empty character.
  • fmtflags flags () const β€” Access to format flags.
  • fmtflags flags (fmtflags __fmtfl) β€” Setting new format flags all at once.
  • __ostream_type & flush () β€” Synchronizing the stream buffer.
  • locale getloc () const β€” Locale access.
  • bool good () const β€” Fast error checking.
  • locale imbue (const locale &__loc) β€” Moves to a new locale.
  • long & iword (int __ix) β€” Access to integer array.
  • char narrow (char_type __c, char __dfault) const β€” Squeezes characters.
  • __ostream_type & operator<< (__streambuf_type *__sb) β€” Extracting from another streambuf.
  • __ostream_type & operator<< (const void *__p) β€” Pointer arithmetic inserters.
  • __ostream_type & operator<< (nullptr_t) β€” signature only, no extra description on the page
  • 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 __fn with parameter __index.
  • __ostream_type & seekp (off_type, ios_base::seekdir) β€” Changing the current write position.
  • __ostream_type & seekp (pos_type) β€” Changing the current write position.
  • fmtflags setf (fmtflags __fmtfl) β€” Setting new format flags.
  • fmtflags setf (fmtflags __fmtfl, fmtflags __mask) β€” Setting new format flags.
  • void setstate (iostate __state) β€” Sets additional flags in the error state.
  • pos_type tellp () β€” Getting the current write position.
  • basic_ostream< _CharT, _Traits > * tie () const β€” Fetches the current tied stream.
  • basic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr) β€” Ties this stream to an output stream.
  • void unsetf (fmtflags __mask) β€” Clearing format flags.
  • char_type widen (char __c) const β€” Widens characters.
  • streamsize width () const β€” Flags access.
  • streamsize width (streamsize __wide) β€” Changing flags.
  • __ostream_type & operator<< (__ostream_type &(*__pf)(__ostream_type &)) β€” Interface for manipulators.
  • __ostream_type & operator<< (__ios_type &(*__pf)(__ios_type &)) β€” Interface for manipulators.
  • __ostream_type & operator<< (ios_base &(*__pf)(ios_base &)) β€” Interface for manipulators.

🌈 Inserters 🌈

All the operator<< functions (aka formatted output functions) have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This can have several effects, concluding with the setting of a status flag; see the sentry documentation for more.

If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.

If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state without causing an ios_base::failure to be thrown. The original exception will then be rethrown.

  • __ostream_type & operator<< (long __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (unsigned long __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (bool __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (short __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (unsigned short __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (int __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (unsigned int __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (long long __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (unsigned long long __n) β€” Integer arithmetic inserters.
  • __ostream_type & operator<< (double __f) β€” Floating point arithmetic inserters.
  • __ostream_type & operator<< (float __f) β€” Floating point arithmetic inserters.
  • __ostream_type & operator<< (long double __f) β€” Floating point arithmetic inserters.

πŸ’– Unformatted Output Functions πŸ’–

All the unformatted output functions have some common behavior. Each starts by constructing a temporary object of type std::basic_ostream::sentry. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more.

If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument.

If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state. If badbit is on in the stream's exceptions mask, the exception will be rethrown without completing its actions.

  • __ostream_type & put (char_type __c) β€” Simple insertion.
  • __ostream_type & write (const char_type *__s, streamsize __n) β€” Character string insertion.
  • operator bool () const β€” The quick-and-easy status check.
  • bool operator! () const β€” The quick-and-easy status check.

πŸ‘‘ Static Public Member Functions πŸ‘‘

  • static bool sync_with_stdio (bool __sync=true) β€” Interaction with the standard C I/O objects.
  • static int xalloc () throw () β€” Access to unique indices. yes, the double space before throw () is staying, we are not "fixing" it, bestie

part 1 of 7 is loaded, and the rest of the page is still coming β€” do not close the tab πŸ’…

πŸ’… Static Public Attributes πŸ’…

  • static const openmode __noreplace β€” the source gives this one no description, so we're not gonna invent lore. It's just there, mysterious and iconic. ✨
  • static const fmtflags adjustfield β€” a mask of left|right|internal. Useful for the 2-arg form of setf. πŸŽ€
  • static const openmode app β€” seek to end before each write.
  • static const openmode ate β€” open and seek to end immediately after opening.
  • static const iostate badbit β€” indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). πŸ’€
  • static const fmtflags basefield β€” a mask of dec|oct|hex. Useful for the 2-arg form of setf.
  • static const seekdir beg β€” request a seek relative to the beginning of the stream.
  • static const openmode binary β€” perform input and output in binary mode (as opposed to text mode). This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. 🫢
  • static const fmtflags boolalpha β€” insert/extract bool in alphabetic rather than numeric format.
  • static const seekdir cur β€” request a seek relative to the current position within the sequence.
  • static const fmtflags dec β€” converts integer input or generates integer output in decimal base.
  • static const seekdir end β€” request a seek relative to the current end of the sequence.
  • static const iostate eofbit β€” indicates that an input operation reached the end of an input sequence.
  • static const iostate failbit β€” indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters.
  • static const fmtflags fixed β€” generate floating-point output in fixed-point notation.
  • static const fmtflags floatfield β€” a mask of scientific|fixed. Useful for the 2-arg form of setf.
  • static const iostate goodbit β€” indicates all is well. 😌
  • static const fmtflags hex β€” converts integer input or generates integer output in hexadecimal base.
  • static const openmode in β€” open for input. Default for ifstream and fstream.
  • static const fmtflags internal β€” adds fill characters at a designated internal point in certain generated output, or identical to right if 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 for ofstream and fstream.
  • 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 for ofstream.
  • static const fmtflags unitbuf β€” flushes output after each output operation.
  • static const fmtflags uppercase β€” replaces certain lowercase letters with their uppercase equivalents in generated output.

🧚 Protected Types 🧚

  • enum { _S_local_word_size } β€” that's the enum, bestie. No extra blurb in the source. πŸ¦‹

🌸 Protected Member Functions 🌸

  • basic_ostream (basic_iostream< _CharT, _Traits > &)
  • basic_ostream (basic_ostream &&__rhs)
  • basic_ostream (const basic_ostream &)=delete
  • void _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 &) noexcept
  • void _M_swap (ios_base &__rhs) noexcept
  • void init (basic_streambuf< _CharT, _Traits > *__sb) β€” all setup is performed here. πŸ› οΈ
  • void move (basic_ios &&__rhs)
  • void move (basic_ios &__rhs)
  • basic_ostream & operator= (basic_ostream &&__rhs)
  • basic_ostream & operator= (const basic_ostream &)=delete
  • void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)
  • void swap (basic_ios &__rhs) noexcept
  • void swap (basic_ostream &__rhs)

πŸ“ Protected Attributes πŸ“

  • _Callback_list * _M_callbacks
  • const __ctype_type * _M_ctype
  • iostate _M_exception
  • char_type _M_fill
  • bool _M_fill_init
  • fmtflags _M_flags
  • locale _M_ios_locale
  • _Words _M_local_word [_S_local_word_size]
  • const __num_get_type * _M_num_get
  • const __num_put_type * _M_num_put
  • streamsize _M_precision
  • basic_streambuf< _CharT, _Traits > * _M_streambuf
  • iostate _M_streambuf_state
  • basic_ostream< _CharT, _Traits > * _M_tie
  • streamsize _M_width
  • _Words * _M_word
  • int _M_word_size
  • _Words _M_word_zero

πŸ¦‹ Friends πŸ¦‹

  • class sentry β€” sentry is a friend of the class. We love a supportive bestie. 🫢

🌈 Detailed Description 🌈

template<typename _CharT, typename _Traits>
class std::basic_ostream< _CharT, _Traits >

Template class basic_ostream. πŸ’–

✨ Template Parameters ✨

  • _CharT β€” type of character stream.
  • _Traits β€” traits for character type, defaults to char_traits<_CharT>.

This is the base class for all output streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual output. πŸ‘‘

πŸ’– Member Typedef Documentation πŸ’–

  • typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits >::__num_get_type [inherited] β€” these are non-standard types. Not standard, but they're here and they're doing their thing. πŸ’…
  • typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int __i) [inherited] β€” the type of an event callback function.
    • __e β€” one of the members of the event enum.
    • __b β€” reference to the ios_base object.
    • __i β€” the integer provided when the callback was registered. Event callbacks are user defined functions that get called during several ios_base and basic_ios functions, specifically imbue(), copyfmt(), and ~ios(). πŸ“£
  • typedef _Ios_Fmtflags std::ios_base::fmtflags [inherited] β€” this is a bitmask type. _Ios_Fmtflags is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type fmtflags are:
    • boolalpha
    • dec
    • fixed
    • hex
    • internal
    • left
    • oct
    • right
    • scientific
    • showbase
    • showpoint
    • showpos
    • skipws
    • unitbuf
    • uppercase
    • adjustfield
    • basefield
    • floatfield
  • 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:
    • badbit
    • eofbit
    • failbit
    • goodbit
  • 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:
    • app
    • ate
    • binary
    • in
    • out
    • trunc
  • typedef _Ios_Seekdir std::ios_base::seekdir [inherited] β€” this is an enumerated type. _Ios_Seekdir is implementation-defined. Defined values of type seekdir are:
    • beg
    • cur, equivalent to SEEK_CUR in the C standard library.
    • end, equivalent to SEEK_END in the C standard library.

πŸ”₯ Member Enumeration Documentation πŸ”₯

  • enum std::ios_base::event [inherited] β€” the set of events that may be passed to an event callback. erase_event is used during ~ios() and copyfmt(). imbue_event is used during imbue(). copyfmt_event is used during copyfmt(). πŸŒ€

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

  • template<typename _CharT , typename _Traits > 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. References std::basic_ios< _CharT, _Traits >::init().
  • template<typename _CharT , typename _Traits > virtual std::basic_ostream< _CharT, _Traits >::~basic_ostream () [inline], [virtual] β€” base destructor. This does very little apart from providing a virtual base dtor.

πŸ’œ Member Function Documentation πŸ’œ

  • const locale & std::ios_base::_M_getloc () const [inline], [inherited] β€” locale access. Returns: a reference to the current locale. Like getloc above, but returns a reference instead of generating a copy. Referenced by std::money_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().
  • template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::bad () const [inline], [inherited] β€” fast error checking. Returns: true if the badbit is set. Note that other iostate flags may also be set. References std::ios_base::badbit, and std::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] β€” [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. 🧼

Referenced by (still rolling over from the last one, she's long πŸ‘€): std::basic_ios< _CharT, _Traits >::exceptions(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::__detail::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().


πŸŽ€ copyfmt() β€” the "steal her whole personality" function [inherited]

template<typename _CharT , typename _Traits > basic_ios< _CharT, _Traits > & std::basic_ios< _CharT, _Traits >::copyfmt (const basic_ios< _CharT, _Traits > & __rhs) [inherited]

Copies fields of __rhs into this. It's giving glow-up-by-osmosis, bestie. ✨

Parameters

  • __rhs β€” the source values for the copies.

Returns

Reference to this object.

The actual tea β˜•: all fields of __rhs are copied into this object except that rdbuf() and rdstate() stay exactly as they were (no touchy). All values in the pword and iword arrays get copied too. Before copying, each callback is invoked with erase_event. After copying, each (new) callback is invoked with copyfmt_event. The final step is to copy exceptions(). Order matters, she's a whole ritual. πŸ•―οΈ

References: std::__addressof(), std::basic_ios< _CharT, _Traits >::exceptions(), std::basic_ios< _CharT, _Traits >::fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), std::basic_ios< _CharT, _Traits >::tie(), std::tie(), and std::ios_base::width().


πŸ¦‹ eof() β€” the quick vibe check for end-of-file [inline], [inherited]

template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::eof () const [inline],  [inherited]

Fast error checking. Literally a speedrun. πŸƒβ€β™€οΈπŸ’¨

Returns

True if the eofbit is set.

Heads up bestie: other iostate flags may also be set. So like, don't read too much into it. πŸ™ˆ

References: std::ios_base::eofbit, and std::basic_ios< _CharT, _Traits >::rdstate().


🌸 exceptions() (getter) β€” peeking at the throw mask [inline], [inherited]

template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline],  [inherited]

Throwing exceptions on errors. Dramatic? Maybe. Correct? Yes. πŸ’…

Returns

The current exceptions mask.

This changes nothing in the stream β€” total window shopping, no buying. See the one-argument version of exceptions(iostate) for the meaning of the return value. πŸ‘€

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt().


πŸ’… exceptions(iostate) β€” setting the throw mask, aka the drama switch [inline], [inherited]

template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline],  [inherited]

Throwing exceptions on errors.

Parameters

  • __except β€” the new exceptions mask.

So here's the sitch: by default, error flags are set silently (no cap, they just sit there). But you can set an exceptions mask for each stream β€” if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown. 🚨

And this is the spicy part πŸ”₯: if the error flag is already set when the exceptions mask is added, the exception is immediately thrown. Not later. Right then. Try running the following under GCC 3.1 or later:

#include <iostream>
#include <fstream>
#include <exception>

int main()
{
    std::set_terminate (__gnu_cxx::__verbose_terminate_handler);

    std::ifstream f ("/etc/motd");

    std::cerr << "Setting badbit\n";
    f.setstate (std::ios_base::badbit);

    std::cerr << "Setting exception mask\n";
    f.exceptions (std::ios_base::badbit);
}

References: std::basic_ios< _CharT, _Traits >::clear().


πŸ“ fail() β€” the fast "is she okay?" check [inline], [inherited]

template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::fail () const [inline],  [inherited]

Fast error checking.

Returns

True if either the badbit or the failbit is set.

Checking the badbit in fail() is historical practice β€” think vintage, not vibes-based. πŸ•°οΈ And note that other iostate flags may also be set.

References: std::ios_base::badbit, std::ios_base::failbit, and std::basic_ios< _CharT, _Traits >::rdstate().

Referenced by std::basic_ios< _CharT, _Traits >::operator bool(), std::basic_ios< _CharT, _Traits >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::regex_traits< _Ch_type >::value().


🧚 fill() (getter) β€” what's the empty character rn? [inline], [inherited]

template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill () const [inline],  [inherited]

Retrieves the empty character.

Returns

The current fill character.

It defaults to a space (' ') in the current locale. Basic, but make it fashion. πŸŽ€

References: std::basic_ios< _CharT, _Traits >::widen().

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::basic_ios< _CharT, _Traits >::fill().


🌈 fill(char_type) β€” setting a new empty character [inline], [inherited]

template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::fill (char_type __ch) [inline],  [inherited]

Sets a new empty character.

Parameters

  • __ch β€” the new character.

Returns

The previous fill character.

So the fill character is used to fill out space when P+ characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. It defaults to a space (' ') in the current locale. Math but make it cute. ✨

References: std::basic_ios< _CharT, _Traits >::fill().


⭐ flags() (getter) β€” access to format flags [inline], [inherited]

fmtflags std::ios_base::flags () const [inline],  [inherited]

Access to format flags.

Returns

The format control flags for both input and output.

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::normal_distribution< double >::operator()(), std::operator<<(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::operator>>().


πŸ”₯ flags(fmtflags) β€” setting ALL the format flags at once [inline], [inherited]

fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline],  [inherited]

Setting new format flags all at once.

Parameters

  • __fmtfl β€” the new flags to set.

Returns

The previous format control flags.

This function overwrites all the format flags with __fmtfl. Not a merge, not a vibe-share β€” a full replace. She ate. πŸ’€


πŸ‘‘ flush() β€” synchronizing the stream buffer

template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush ()

Synchronizing the stream buffer.

Returns

*this

If rdbuf() is a null pointer, changes nothing. Crickets. πŸ¦—

Otherwise, calls rdbuf()->pubsync(), and if that returns -1, sets badbit. Rude of it, but okay. 😭

References: std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().

Referenced by std::flush().


πŸŽ€ getloc() β€” locale access [inline], [inherited]

locale std::ios_base::getloc () const [inline],  [inherited]

Locale access.

Returns

A copy of the current locale.

If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. No locale? She'll just go get the global one herself, independent queen. πŸ’…

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().


πŸ¦‹ good() β€” the actual vibe check [inline], [inherited]

template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::good () const [inline],  [inherited]

Fast error checking.

Returns

True if no error flags are set.

A wrapper around rdstate. Tiny function, huge responsibility. 🫢

References: std::basic_ios< _CharT, _Traits >::rdstate().

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().


🌸 imbue() β€” moving to a new locale [inherited]

template<typename _CharT , typename _Traits > locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]

Moves to a new locale. Relocation era. 🧳✨

Parameters

  • __loc β€” the new locale.

Returns

The previous locale.

Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc). Everybody gets the memo, fr fr. πŸ“¬

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

References: std::ios_base::imbue().

Referenced by std::chrono::operator<<().


🧚 init() β€” where all the setup actually happens [protected], [inherited]

template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]

All setup is performed here. This is called from the public constructor. It is not virtual and cannot be redefined. So like, don't try it bestie, she's not open to edits. πŸ™…β€β™€οΈ

Referenced by std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ifstream< _CharT, _Traits >::basic_ifstream(), std::basic_ios< _CharT, _Traits >::basic_ios(), std::basic_istream< _CharT, _Traits >::basic_istream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_istringstream< _CharT, _Traits, _Alloc >::basic_istringstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ofstream< _CharT, _Traits >::basic_ofstream(), std::basic_ostream< _CharT, _Traits >::basic_ostream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream(), std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream(), std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream(), and std::basic_stringstream< _CharT, _Traits, _Alloc >::basic_stringstream().


πŸ“ iword() β€” access to the integer array [inline], [inherited]

long & std::ios_base::iword (int __ix) [inline],  [inherited]

Access to integer array.

Parameters

  • __ix β€” index into the array.

Returns

A reference to an integer associated with the index.

The iword function provides access to an array of integers that can be used for any purpose. It's a free-for-all, do what you want with it. ✨ The array grows as required to hold the supplied index. All integers in the array are initialized to 0.

⚠️ Okay listen, two things: the implementation reserves several indices, so you should use xalloc to obtain an index that is safe to use. Also, since the array can grow dynamically, it is not safe to hold onto the reference. Like, don't get attached. She moves. 😭

πŸ’œ narrow() β€” squeezes characters [inline], [inherited]

template<typename _CharT , typename _Traits > char std::basic_ios< _CharT, _Traits >::narrow (char_type __c, char __dfault) const [inline], [inherited]

Squeezes characters. Compression core. πŸ—œοΈ

Parameters

  • __c β€” the character to narrow.
  • __dfault β€” the character to narrow.

Returns

The narrowed character.

Okay so for the narrow vibe: it maps a character of char_type to a character of char, if that’s even possible πŸ’…. It returns the result of

std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html ✨


template<typename _CharT , typename _Traits > std::basic_ios< _CharT, _Traits >::operator bool () const [inline], [explicit], [inherited]

The quick-and-easy status check, no cap 🫢. This lets you write constructs such as if (!a_stream) ... and while (a_stream) ...

References: std::basic_ios< _CharT, _Traits >::fail().

template<typename _CharT , typename _Traits > bool std::basic_ios< _CharT, _Traits >::operator! () const [inline], [inherited]

Same quick-and-easy status check energy πŸ’–. This lets you write constructs such as if (!a_stream) ... and while (a_stream) ...

References: std::basic_ios< _CharT, _Traits >::fail().

template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (__ios_type &(*)(__ios_type &) __pf) [inline]

Interface for manipulators, bestie πŸŽ€. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.

template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (__ostream_type &(*)(__ostream_type &) __pf) [inline]

Interface for manipulators again, and yes it’s iconic ✨. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.

template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (__streambuf_type * __sb)

Extracting from another streambuf πŸ‘‘.

Parameters

  • __sb β€” A pointer to a streambuf

This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.

If __sb is NULL, the stream will set failbit in its error state.

Characters are extracted from __sb and inserted into *this until one of the following occurs:

  • the input stream reaches end-of-file,
  • insertion into the output sequence fails (in this case, the character that would have been inserted is not extracted), or
  • an exception occurs while getting a character from __sb, which sets failbit in the error state

If the function inserts no characters, failbit is set.

template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (bool __n) [inline]

Integer arithmetic inserters πŸ“.

Parameters

  • __n β€” A variable of builtin integral type.

Returns

  • *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]

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]

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]

Floating point arithmetic inserters, yes again, and we love consistency πŸ’….

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)

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<< (ios_base &(*)(ios_base &) __pf) [inline]

Interface for manipulators πŸŽ€. Manipulators such as std::endl and std::hex use these functions in constructs like 'std::cout << std::endl'. For more information, see the iomanip header.

template<typename _CharT , typename _Traits > __ostream_type & std::basic_ostream< _CharT, _Traits >::operator<< (long __n) [inline]

Integer arithmetic inserters πŸ’œ.

Parameters

  • __n β€” A variable of builtin integral type.

Returns

  • *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]

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<< (long long __n) [inline]

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 > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::operator<< (short __n)

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.

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]

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<< (unsigned long __n) [inline]

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<< (unsigned long long __n) [inline]

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<< (unsigned short __n) [inline]

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.

streamsize std::ios_base::precision () const [inline], [inherited]

Flags access ✨.

Returns

  • The precision to generate on certain output operations.

Be careful if you try to give a definition of precision here; see DR 189.

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().

streamsize std::ios_base::precision (streamsize __prec) [inline], [inherited]

Changing flags πŸŽ€.

Parameters

  • __prec β€” The new precision value.

Returns

  • The previous value of precision().

template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::put (char_type __c)

Simple insertion 🌸.

Parameters

  • __c β€” The character to insert.

Returns

  • *this

Tries to insert __c.

Note: This function is not overloaded on signed char and unsigned 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().

void *& std::ios_base::pword (int __ix) [inline], [inherited]

Access to void pointer array 🫢.

Parameters

  • __ix β€” Index into the array.

Returns

  • A reference to a void* associated with the index.

The pword function provides access to an array of pointers that can be used for any purpose. The array grows as required to hold the supplied index. All pointers in the array are initialized to 0.

The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference.

template<typename _CharT , typename _Traits > basic_streambuf< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::rdbuf () const [inline], [inherited]

Accessing the underlying buffer πŸ¦‹.

Returns

  • The current stream buffer.

This does not change the state of the stream.

…and bestie, the previous function is also referenced by this absolutely stacked group chat of icons:

  • std::basic_istream< _CharT, _Traits >::sentry::sentry()
  • std::basic_ostream< _CharT, _Traits >::sentry::~sentry()
  • std::basic_ostream< _CharT, _Traits >::flush()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< char >::get()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::getline()
  • std::getline()
  • std::basic_istream< _CharT, _Traits >::ignore()
  • std::basic_istream< _CharT, _Traits >::ignore()
  • std::operator<<()
  • std::basic_istream< _CharT, _Traits >::operator>>()
  • std::operator>>()
  • std::operator>>()
  • std::operator>>()
  • std::operator>>()
  • std::tr2::operator>>()
  • std::basic_ostream< _CharT, _Traits >::put()
  • std::basic_istream< _CharT, _Traits >::putback()
  • std::basic_istream< _CharT, _Traits >::read()
  • std::basic_istream< char >::readsome()
  • std::basic_istream< _CharT, _Traits >::readsome()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_istream< _CharT, _Traits >::sync()
  • std::basic_istream< _CharT, _Traits >::tellg()
  • std::basic_ostream< _CharT, _Traits >::tellp()
  • std::ws()

template<typename _CharT , typename _Traits > basic_streambuf< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::rdbuf (basic_streambuf< _CharT, _Traits > * __sb) [inherited]

Changing the underlying buffer. iconic little buffer-swap moment πŸ’…

Parameters

  • __sb β€” the new stream buffer πŸŽ€

Returns

  • The previous stream buffer.

Associates a new buffer with the current stream, and clears the error state.

⚠️ okay so this is a whole historical-accidents situation: due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error β€” this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. For example:
std::fstream     foo;         // or some other derived type
std::streambuf*  p = .....;

foo.ios::rdbuf(p);            // ios == basic_ios<char>

template<typename _CharT , typename _Traits > iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [inherited]

Returns the error state of the stream buffer. vibe check: what’s the stream feeling rn? πŸ¦‹

Returns

  • A bit pattern (well, isn’t everything?)

See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().

Also referenced by: std::basic_ios< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::eof(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ios< _CharT, _Traits >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().


void std::ios_base::register_callback (event_callback __fn, int __index) [inherited]

Add the callback __fn with parameter __index. callback registration, but make it cute ✨

Parameters

  • __fn β€” the function to add.
  • __index β€” the integer to pass to the function when invoked.

Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered.


template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (off_type __off, ios_base::seekdir __dir)

Changing the current write position. scoot scoot, output cursor πŸŽ€

Parameters

  • __off β€” a file offset object.
  • __dir β€” the direction in which to seek.

Returns

  • *this

If fail() is not true, calls rdbuf()->pubseekoff(off,dir). If that function fails, sets failbit.

References: std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (pos_type __pos)

Changing the current write position. same energy, different coordinates πŸ¦‹

Parameters

  • __pos β€” a file position object.

Returns

  • *this

If fail() is not true, calls rdbuf()->pubseekpos(pos). If that function fails, sets failbit.

References: std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


fmtflags std::ios_base::setf (fmtflags __fmtfl) [inline], [inherited]

Setting new format flags. flags on flags on flags, no cap ⭐

Parameters

  • __fmtfl β€” additional flags to set.

Returns

  • The previous format control flags.

This function sets additional flags in format control. Flags that were previously set remain set.

Also referenced by: std::__detail::operator>>().


fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited]

Setting new format flags. masked-up little flag situation πŸ“

Parameters

  • __fmtfl β€” additional flags to set.
  • __mask β€” the flags mask for fmtfl.

Returns

  • The previous format control flags.

This function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield.


template<typename _CharT , typename _Traits > void std::basic_ios< _CharT, _Traits >::setstate (iostate __state) [inline], [inherited]

Sets additional flags in the error state. error-state glow-up, but make it bitwise πŸ’œ

Parameters

  • __state β€” the additional state flag(s) to set.

See std::ios_base::iostate for the possible bit values.

References: std::basic_ios< _CharT, _Traits >::clear(), and std::basic_ios< _CharT, _Traits >::rdstate().

Also referenced by, and bestie this list is long, so buckle up:

  • std::basic_istream< _CharT, _Traits >::sentry::sentry()
  • std::basic_ostream< _CharT, _Traits >::sentry::sentry()
  • std::basic_ostream< _CharT, _Traits >::sentry::~sentry()
  • std::basic_ifstream< _CharT, _Traits >::close()
  • std::basic_ofstream< _CharT, _Traits >::close()
  • std::basic_fstream< _CharT, _Traits >::close()
  • std::basic_ostream< _CharT, _Traits >::flush()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::basic_istream< _CharT, _Traits >::get()
  • std::getline()
  • std::getline()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_fstream< _CharT, _Traits >::open()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::basic_ifstream< _CharT, _Traits >::open()
  • std::basic_fstream< _CharT, _Traits >::open()
  • std::basic_ofstream< _CharT, _Traits >::open()
  • std::operator<<()
  • std::basic_ostream< _CharT, _Traits >::operator<<()
  • std::operator<<()
  • std::basic_istream< _CharT, _Traits >::operator>>()
  • std::operator>>()
  • std::operator>>()
  • std::operator>>()
  • std::basic_istream< _CharT, _Traits >::operator>>()
  • std::tr2::operator>>()
  • std::basic_ostream< _CharT, _Traits >::put()
  • std::basic_istream< _CharT, _Traits >::putback()
  • std::basic_istream< _CharT, _Traits >::read()
  • std::basic_istream< _CharT, _Traits >::readsome()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_ostream< _CharT, _Traits >::seekp()
  • std::basic_istream< _CharT, _Traits >::sync()
  • std::ws()

static bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited]

Interaction with the standard C I/O objects. C I/O and C++ I/O walking into the same room πŸ‘€

Parameters

  • __sync β€” whether to synchronize or not.

Returns

  • True if the standard streams were previously synchronized.

The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary


template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp ()

Getting the current write position. where’s the output cursor at? let’s ask her πŸŽ€

Returns

  • A file position object.

If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,out).

References: std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::out, and std::basic_ios< _CharT, _Traits >::rdbuf().


template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [inherited]

Fetches the current tied stream. who is she emotionally attached to? asking for a stream πŸ¦‹

Returns

  • A pointer to the tied stream, or 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.

Also referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::basic_ios< _CharT, _Traits >::copyfmt().


template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie (basic_ostream< _CharT, _Traits > * __tiestr) [inline], [inherited]

Ties this stream to an output stream. establishing the link, the lore, the bond πŸ’…

Parameters

  • __tiestr β€” the output stream.

Returns

  • The previously tied output stream, or NULL if the stream was not tied.

This sets up a new tie; see tie() for more.


void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited]

Clearing format flags. un-stanning a flag πŸ“

Parameters

  • __mask β€” the flags to unset.

This function clears __mask in the format flags.


template<typename _CharT , typename _Traits > char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited]

Widens characters. char says β€œmake me bigger,” and she does ⭐

Parameters

  • __c β€” the character to widen.

Returns

  • The widened character.

Maps a character of char to a character of char_type.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).widen(c)

Additional l10n notes are at http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Also referenced by: std::endl(), std::basic_ios< _CharT, _Traits >::fill(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_istream< _CharT, _Traits >::getline(), std::operator<<(), std::operator<<(), and std::tr2::operator>>().


streamsize std::ios_base::width () const [inline], [inherited]

Flags access. how wide are we printing, babes? πŸ’œ

Returns

  • The minimum field width to generate on output operations.

Minimum field width refers to the number of characters.

Also referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().


streamsize std::ios_base::width (streamsize __wide) [inline], [inherited]

Changing flags. short queen behavior, honestly πŸŽ€

Parameters:

  • __wide β€” the new width value, slay.

Returns: the previous value of width(). Yep, it hands you back the old one so you can restore it later, iykyk.


🌸 template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::write (const char_type * __s, streamsize __n)

Okay so this one is literally called Character string insertion and it's giving main character energy for real.

Parameters:

  • __s β€” the array to insert πŸ’–
  • __n β€” maximum number of characters to insert

Returns *this.

So here's the vibe: characters get copied from __s and inserted into the stream, and this keeps going until one of these two things happens:

  • __n characters are inserted βœ…
  • inserting into the output sequence fails β€” and in that case, badbit gets set in the stream's error state 😭
Note bestie: this function is not overloaded on signed char and unsigned char. Don't come for it, that's just how it is.

πŸ¦‹ static int std::ios_base::xalloc () [static], [inherited]

Access to unique indices. Returns an integer different from all previous calls. No cap.

This function returns a unique integer every single time you call it β€” every time, fr fr. It can be used for any purpose, but it's primarily intended to be a unique index for the iword and pword functions. The expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. 🫢

The implementation maintains a static variable that is incremented and returned on each invocation. xalloc is guaranteed to return an index that is safe to use in the iword and pword arrays. Iconic behaviour, honestly.


✨ MEMBER DATA DOCUMENTATION ✨

πŸ’œ const fmtflags std::ios_base::adjustfield [static], [inherited]

A mask of left|right|internal. Useful for the 2-arg form of setf. Lowkey handy.

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().

πŸŽ€ const openmode std::ios_base::app [static], [inherited]

Seek to end before each write. Every. Single. Write. πŸ’…

Referenced by std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().

⭐ const openmode std::ios_base::ate [static], [inherited]

Open and seek to end immediately after opening. (Not the same as app, bestie β€” app seeks before each write, ate does it once at open time. The page says what it says, and that's what it says.)

Referenced by std::basic_filebuf< _CharT, _Traits >::open().

πŸ’€ const iostate std::ios_base::badbit [static], [inherited]

Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file). This is the bad one. The really bad one. 😭

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::bad(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< char >::tellg(), std::basic_istream< _CharT, _Traits >::tellg(), and std::ws().

🌈 const fmtflags std::ios_base::basefield [static], [inherited]

A mask of dec|oct|hex. Useful for the 2-arg form of setf.

Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().

🧚 const seekdir std::ios_base::beg [static], [inherited]

Request a seek relative to the beginning of the stream. Classic. The original. The blueprint. πŸ‘‘

Referenced by std::basic_filebuf< _CharT, _Traits >::seekpos().

πŸ“ const openmode std::ios_base::binary [static], [inherited]

Perform input and output in binary mode (as opposed to text mode).

⚠️ Heads up: this is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. For real, read the link before you fight me on it.

Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().

🫢 const fmtflags std::ios_base::boolalpha [static], [inherited]

Insert/extract bool in alphabetic rather than numeric format. So true instead of 1, which is honestly so much more readable πŸ’–

Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().

πŸ¦‹ const seekdir std::ios_base::cur [static], [inherited]

Request a seek relative to the current position within the sequence. It's giving "where am I right now" energy.

Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().

🌸 const fmtflags std::ios_base::dec [static], [inherited]

Converts integer input or generates integer output in decimal base. Base 10, the people's base.

Referenced by std::dec().

πŸŽ€ const seekdir std::ios_base::end [static], [inherited]

Request a seek relative to the current end of the sequence. The finale. The last page of the book. πŸ“–

Referenced by std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().

😭 const iostate std::ios_base::eofbit [static], [inherited]

Indicates that an input operation reached the end of an input sequence. You hit the wall, bestie. There's nothing left to read.

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ios< _CharT, _Traits >::eof(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< char >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().

πŸ™ˆ const iostate std::ios_base::failbit [static], [inherited]

Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. Not the end of the world like badbit, but it's still a whole mood. πŸ’€

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_ifstream< _CharT, _Traits >::close(), std::basic_ofstream< _CharT, _Traits >::close(), std::basic_fstream< _CharT, _Traits >::close(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ios< _CharT, _Traits >::fail(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ifstream< _CharT, _Traits >::open(), std::basic_fstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), and std::basic_ostream< _CharT, _Traits >::seekp().

πŸ”₯ const fmtflags std::ios_base::fixed [static], [inherited]

Generate floating-point output in fixed-point notation. No sneaky exponent jumps, just the digits, bestie.

Referenced by std::fixed(), and std::hexfloat().

🌟 const fmtflags std::ios_base::floatfield [static], [inherited]

A mask of scientific|fixed. Useful for the 2-arg form of setf.

Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().

🧚 const iostate std::ios_base::goodbit [static], [inherited]

Indicates all is well. ✨ The dream. The goal. Zero problems, zero drama.

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::time_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< char >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< char >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().

πŸ’œ const fmtflags std::ios_base::hex [static], [inherited]

Converts integer input or generates integer output in hexadecimal base. Base 16 girlies rise 🫢

Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::hex().

🌈 const openmode std::ios_base::in [static], [inherited]

Open for input. Default for ifstream and fstream. The standard-issue opening move, no notes.

  • const fmtflags std::ios_base::internal [static], [inherited] β€” drops fill characters at a designated internal point in certain generated output. No internal point designated? Then it's literally identical to right. Lowkey the flex of formatting flags πŸ’…

Referenced by std::internal().

  • const fmtflags std::ios_base::left [static], [inherited] β€” puts fill characters on the right (the final positions) of certain generated output. Translating for the group chat: the thing you print is flush left. 🫢

Referenced by std::num_put< _CharT, _OutIter >::do_put(), and std::left().

  • const fmtflags std::ios_base::oct [static], [inherited] β€” converts integer input, or generates integer output, in octal base. Base eight supremacy, no cap ✨

Referenced by std::oct().

  • const openmode std::ios_base::out [static], [inherited] β€” open for output. This is the default for ofstream and fstream, so bestie you get it for free πŸŽ€

Referenced by std::basic_filebuf< _CharT, _Traits >::_M_set_buffer(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_ofstream< _CharT, _Traits >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::basic_filebuf< _CharT, _Traits >::xsputn(). (Yes it's a whole entourage. It's giving main character energy πŸ‘‘)

  • const fmtflags std::ios_base::right [static], [inherited] β€” adds fill characters on the left (the initial positions) of certain generated output. In human words: the thing you print is flush right. 🌸

Referenced by std::right().

  • const fmtflags std::ios_base::scientific [static], [inherited] β€” generates floating-point output in scientific notation. Big science vibes πŸ”₯

Referenced by std::hexfloat(), and std::scientific().

  • const fmtflags std::ios_base::showbase [static], [inherited] β€” generates a prefix that indicates the numeric base of generated integer output. So everyone knows which base you're serving πŸ’–

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::noshowbase(), and std::showbase().

  • const fmtflags std::ios_base::showpoint [static], [inherited] β€” generates a decimal-point character unconditionally in generated floating-point output. Unconditional, like my love for clean output πŸ¦‹

Referenced by std::noshowpoint(), and std::showpoint().

  • const fmtflags std::ios_base::showpos [static], [inherited] β€” generates a + sign in non-negative generated numeric output. Positivity, literally πŸ’œ

Referenced by std::noshowpos(), and std::showpos().

  • const fmtflags std::ios_base::skipws [static], [inherited] β€” skips leading white space before certain input operations. The "ignore them, they're not worth it" of flags πŸ™ˆ

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::noskipws(), std::__detail::operator>>(), and std::skipws().

  • const openmode std::ios_base::trunc [static], [inherited] β€” truncate an existing stream when opening. This is the default for ofstream. ⚠️ Yeah, it wipes what was there β€” that's the whole point, so don't come for me when your file is gone πŸ’€
  • const fmtflags std::ios_base::unitbuf [static], [inherited] β€” flushes output after each output operation. Impatient queen behavior, and honestly valid 🧚

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().

  • const fmtflags std::ios_base::uppercase [static], [inherited] β€” replaces certain lowercase letters with their uppercase equivalents in generated output. SHOUTING, but make it formatted ✨

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::nouppercase(), and std::uppercase().


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. Not me, not you, not anyone's fave β€” Doxygen did that. Iconic of it, fr fr πŸ€–πŸ’…


Okay that's the whole page, bestie β€” every flag, every Referenced by, every last crumb. This one's libstdc++'s std::basic_ostream< _CharT, _Traits >(3cxx) man page, straight from the Doxygen-generated source code, and you read the entire thing. Obsessed with your commitment. Go take a lil break, drink some water, and remember: std::endl flushes, so use it wisely πŸŒˆπŸ«ΆπŸŽ€

πŸ“¦ where this page comes from