STD::OSTREAM_ITERATOR(3)

🌸 NAME 🌸

std::ostream_iterator< _Tp, _CharT, _Traits > β€” bestie, this is the little guy that gives you output iterator semantics for streams πŸ’– (it's a (3) manual page, library functions manual, if you were wondering where you wandered into)


✨ SYNOPSIS ✨

#include <iterator>

It inherits std::iterator< output_iterator_tag, void, void, void, void >.

πŸŽ€ Public Types πŸŽ€

  • typedef output_iterator_tag iterator_category β€” one of the tag types 🏷️
  • typedef void pointer β€” this type represents a pointer-to-value_type
  • typedef void reference β€” this type represents a reference-to-value_type
  • typedef void value_type β€” the type "pointed to" by the iterator
    • using difference_type β€” public typedef, that's it, that's the whole vibe
  • typedef _CharT char_type β€” public typedef
  • typedef _Traits traits_type β€” public typedef
  • typedef basic_ostream< _CharT, _Traits > ostream_type β€” public typedef

πŸ¦‹ Public Member Functions πŸ¦‹

  • ostream_iterator (const ostream_iterator &__obj) noexcept β€” copy constructor πŸ’…
  • ostream_iterator (ostream_type &__s) noexcept β€” construct from an ostream
  • ostream_iterator (ostream_type &__s, const _CharT *__c) noexcept
  • ostream_iterator & operator* () noexcept
  • ostream_iterator & operator++ () noexcept
  • ostream_iterator & operator++ (int) noexcept
  • ostream_iterator & operator= (const _Tp &__value) β€” writes value to the underlying ostream using operator<<. If it was constructed with a delimiter string, it writes the delimiter to the ostream too ✍️
  • ostream_iterator & operator= (const ostream_iterator &)=default

πŸ‘‘ Detailed Description πŸ‘‘

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
class std::ostream_iterator< _Tp, _CharT, _Traits >"Provides output
    iterator semantics for streams.

No cap, this class hands you an iterator that writes to an ostream 🫢 The type Tp is the only type written by this iterator, and there must be an operator<<(Tp) defined. Periodt.

🌈 Template Parameters 🌈

  • _Tp β€” the type to write to the ostream.
  • _CharT β€” the ostream char_type.
  • _Traits β€” the ostream char_traits.

πŸ’œ Member Typedef Documentation πŸ’œ

char_type

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
typedef _CharT std::ostream_iterator< _Tp, _CharT, _Traits >::char_type

Public typedef, iconic behavior πŸ’«

difference_type

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
using std::ostream_iterator< _Tp, _CharT, _Traits >::difference_type

Public typedef ✨

iterator_category (inherited)

typedef output_iterator_tag std::iterator< output_iterator_tag, void, void,
    void, void >::iterator_category [inherited]

One of the tag types 🏷️

ostream_type

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
typedef basic_ostream<_CharT, _Traits>
    std::ostream_iterator< _Tp, _CharT, _Traits >::ostream_type

Public typedef 🌸

pointer (inherited)

typedef void std::iterator< output_iterator_tag, void, void, void, void
    >::pointer [inherited]

This type represents a pointer-to-value_type.

reference (inherited)

typedef void std::iterator< output_iterator_tag, void, void, void, void
    >::reference [inherited]

This type represents a reference-to-value_type.

traits_type

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
typedef _Traits std::ostream_iterator< _Tp, _CharT, _Traits >::traits_type

Public typedef πŸ’–

value_type (inherited)

typedef void std::iterator< output_iterator_tag, void, void, void, void
    >::value_type [inherited]

The type "pointed to" by the iterator πŸ‘€


🧚 Constructor & Destructor Documentation 🧚

ostream_iterator (ostream_type & __s) β€” from an ostream

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
std::ostream_iterator< _Tp, _CharT, _Traits >::ostream_iterator (ostream_type
    & __s) [inline], [noexcept]

Construct from an ostream 🌊

References std::__addressof().

Referenced by ostream_iterator().

ostream_iterator (ostream_type & __s, const _CharT * __c) β€” from an ostream + delimiter

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
std::ostream_iterator< _Tp, _CharT, _Traits >::ostream_iterator (ostream_type
    & __s, const _CharT * __c) [inline], [noexcept]

Construct from an ostream.

The delimiter string c is written to the stream after every Tp written to the stream. The delimiter is not copied, and thus must not be destroyed while this iterator is in use ⚠️

Parameters

  • __s β€” underlying ostream to write to.
  • __c β€” CharT delimiter string to insert.

References std::__addressof().

ostream_iterator (const ostream_iterator< _Tp, _CharT, _Traits > & __obj) β€” copy constructor

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
std::ostream_iterator< _Tp, _CharT, _Traits >::ostream_iterator (const
    ostream_iterator< _Tp, _CharT, _Traits > & __obj) [inline], [noexcept]

Copy constructor 🫢

References ostream_iterator().


πŸ“ Member Function Documentation πŸ“

operator= (const _Tp & __value)

template<typename _Tp, typename _CharT = char, typename _Traits =
    char_traits<_CharT>>
ostream_iterator & std::ostream_iterator< _Tp, _CharT, _Traits >::operator=
    (const _Tp & __value) [inline]

Writes value to the underlying ostream using operator<<. If it was constructed with a delimiter string, writes the delimiter to the ostream too. Slay πŸ’…


⭐ Author ⭐

Generated automatically by Doxygen for libstdc++ from the source code.


okay bestie that's the whole page πŸ’– that was libstdc++, std::ostre..., _Traits >(3), and yes the title got cut off by the page header, we don't talk about it πŸ™ˆ go write some iterators, you've got this πŸ‘‘βœ¨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms