STD::ISTREAM_ITERATOR(3)
β¨ NAME β¨
okay so bestie, meet std::istream_iterator< _Tp, _CharT, _Traits, _Dist > β it's the whole vibe of Provides input iterator semantics for streams. π
like literally, it lets you treat a stream like an iterator. iconic behaviour, no cap.
π¦ SYNOPSIS π¦
first things first, you gotta pull it in:
#include <iterator>
and heads up β it Inherits from:
std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >
it's giving "I got everything from my parent class and I'm thriving". π«Ά
π Public Types π
the little type besties it brings along:
typedef _CharT char_typetypedef ptrdiff_t difference_typeβ Distance between iterators is represented as this type. (fr fr, that's literally what it's for)typedef basic_istream< _CharT, _Traits > istream_typetypedef input_iterator_tag iterator_categoryβ One of the tag types. π·οΈtypedef const _Tp * pointerβ This type represents a pointer-to-value_type.typedef const _Tp & referenceβ This type represents a reference-to-value_type.typedef _Traits traits_typetypedef _Tp value_typeβ The type "pointed to" by the iterator. π
π Public Member Functions π
the moves it can do:
constexpr istream_iterator () noexcept(/*conditional */)β Construct end of input stream iterator. (the classic "end" one, we love her)constexpr istream_iterator (const istream_iterator &__obj) noexcept(/*conditional */)constexpr istream_iterator (default_sentinel_t) noexcept(is_nothrow_default_constructible_v< _Tp >)istream_iterator (istream_type &__s)β Construct start of input stream iterator. (the "begin" one, the main character β¨)const _Tp & operator* () const noexceptistream_iterator & operator++ ()istream_iterator operator++ (int)const _Tp * operator-> () const noexceptistream_iterator & operator= (const istream_iterator &)=default
πΈ Friends πΈ
the besties it fw:
bool operator== (const istream_iterator &__i, default_sentinel_t) noexceptbool operator== (const istream_iterator &__x, const istream_iterator &__y) noexceptβ Return true if the iterators refer to the same stream, or are both at end-of-stream. π«Ά
π Detailed Description π
here's the full template glow-up:
template<typename _Tp, typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
class std::istream_iterator< _Tp, _CharT, _Traits, _Dist >
and what does it do? "Provides input iterator semantics for streams." that's it, that's the whole personality. π
π§ Member Typedef Documentation π§
these ones are all inherited, so they came pre-loaded from std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >:
typedef ptrdiff_t std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >::difference_type[inherited]β Distance between iterators is represented as this type.typedef input_iterator_tag std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >::iterator_category[inherited]β One of the tag types. π·οΈtypedef const _Tp * std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >::pointer[inherited]β This type represents a pointer-to-value_type.typedef const _Tp & std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >::reference[inherited]β This type represents a reference-to-value_type.typedef _Tp std::iterator< input_iterator_tag, _Tp, ptrdiff_t, const _Tp *, const _Tp & >::value_type[inherited]β The type "pointed to" by the iterator.
β Constructor & Destructor Documentation β
π the no-arg one
template<typename _Tp, typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
std::istream_iterator< _Tp, _CharT, _Traits, _Dist >::istream_iterator ()
[inline], [constexpr], [noexcept]
Construct end of input stream iterator. that's the whole job. π
- Referenced by
operator==.
π¦ the stream-taking one
template<typename _Tp, typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
std::istream_iterator< _Tp, _CharT, _Traits, _Dist >::istream_iterator
(istream_type & __s) [inline]
Construct start of input stream iterator. the beginning of the story, literally. β¨
- References
std::__addressof().
π₯ Friends And Related Symbol Documentation π₯
template<typename _Tp, typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
bool operator== (const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __x,
const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __y)
[friend]
Return true if the iterators refer to the same stream, or are both at end-of-stream. so like, same stream = besties, both at the end = also besties. equality ate and left no crumbs. π
- References
istream_iterator().
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
like, nobody hand-wrote this, the robot did it, and honestly? slay. π€β¨
no cap, this page came straight out of the libstdc++ manual β the Library Functions Manual, section(3), the one and onlystd::istre...s, _Dist >(3). π that's the whole sign-off bestie, go read your streams. ππΈπ¦
π¦ 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