STD::ISTREAM_ITERATOR(3cxx)
π
std::istream_iterator< _Tp, _CharT, _Traits, _Dist > β the 3cxx glow-up β¨
okay so bestie, picture this: you've got a stream (yes, like std::cin, the whole vibe) and you want to walk through it like it's a playlist. that's literally what this class does. it's from the <iterator> header, and it's a template with four whole parameters. we love a customizable icon π
πΈ NAME πΈ
std::istream_iterator< _Tp, _CharT, _Traits, _Dist > β ngl, it "provides input iterator semantics for streams." that's the whole job. that's the moment. periodt.
π¦ SYNOPSIS π¦
#include <iterator>
and it inherits from:
std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >
like, it's giving nepo baby but in a cute inheritance way π
π Public Types π
typedef _CharT char_typeβ the character type, no notes.typedef _Distance difference_typeβ lowkey the "distance between iterators" rep, like the space between two vibes.typedef basic_istream< _CharT, _Traits > istream_typeβ the stream type it rolls with.typedef _Category iterator_categoryβ one of the tag types, iykyk.typedef _Pointer pointerβ this one "represents a pointer-to-value_type," which is exactly what it sounds like.typedef _Reference referenceβ and this is the "reference-to-value_type" one. slay.typedef _Traits traits_typeβ traits, the personality of your characters.typedef _Tp value_typeβ the type "pointed to" by the iterator. main character type energy fr fr.
π Public Member Functions π
constexpr istream_iterator () noexcept(/*conditional */)β constructs the end of input stream iterator. this is your "we're done here" energy πconstexpr istream_iterator (const istream_iterator &__obj) noexcept(/*conditional */)β the copy constructor, quietly doing its thing.istream_iterator (istream_type &__s)β constructs the start of input stream iterator. your "let's gooo" moment π₯const _Tp & operator* () const noexceptβ dereference, as one does.istream_iterator & operator++ ()β prefix increment, the classic.istream_iterator operator++ (int)β postfix increment, the one with the int that nobody uses for anything.const _Tp * operator-> () const noexceptβ arrow operator, pointing at things, very demure.istream_iterator & operator= (const istream_iterator &)=defaultβ assignment, defaulted, no drama.
π«Ά Friends π«Ά
bool operator== (const istream_iterator &__x, const istream_iterator &__y) noexceptβ returnstrueif the iterators refer to the same stream, or are both at end-of-stream. honestly iconic behavior.
π§ Detailed Description π§
here's the full template signature because bestie you need the receipts:
template<typename _Tp, typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
class std::istream_iterator< _Tp, _CharT, _Traits, _Dist >
and its whole personality is: "Provides input iterator semantics for streams." that's it. that's the thesis. π
π Member Typedef Documentation π
okay so these are all <italic>[inherited]</italic> from std::iterator, and they all share the same template preamble, so let me give it to you once:
template<typename _Category , typename _Tp , typename _Distance =
ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&>
now, the actual typedefs, one by one, because we don't skip β¨
typedef _Distance std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >::difference_type[inherited] β "Distance between iterators is represented as this type." yes, exact words, we don't editorialize the facts.typedef _Category std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >::iterator_category[inherited] β "One of the tag types." queen of being one of the tag types.typedef _Pointer std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >::pointer[inherited] β "This type represents a pointer-to-value_type."typedef _Reference std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >::reference[inherited] β "This type represents a reference-to-value_type."typedef _Tp std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference >::value_type[inherited] β "The type 'pointed to' by the iterator."
π Constructor & Destructor Documentation π
same deal, the template preamble is:
template<typename _Tp , typename _CharT = char, typename _Traits =
char_traits<_CharT>, typename _Dist = ptrdiff_t>
std::istream_iterator< _Tp, _CharT, _Traits, _Dist >::istream_iterator ()β tags: [inline], [constexpr], [noexcept]. constructs the end of input stream iterator. your "i'm done scrolling" iterator πstd::istream_iterator< _Tp, _CharT, _Traits, _Dist >::istream_iterator (istream_type & __s)β tag: [inline]. constructs the start of input stream iterator from a stream reference. go get 'em π
β Friends And Related Symbol Documentation β
bool operator== (const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __x, const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __y)β tag: [friend]. returnstrueif the iterators refer to the same stream, or are both at end-of-stream. friendship ended with everything else, nowoperator==is my best friend π«Ά
π Author π
"Generated automatically by Doxygen for libstdc++ from the source code." β so nobody hand-wrote this, it's a robot flexing. respect tho. π€
ngl this whole page is auto-generated docs energy, but it's our auto-generated docs energy. no cap. π
and that's the tea β β brought to you by libstdc++, generated by Doxygen straight from the source code, under the 3cxx section banner. mwah π β¨πΈπ
π¦ 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