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 β€” returns true if 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 🏁

  • bool operator== (const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __x, const istream_iterator< _Tp, _CharT, _Traits, _Dist > & __y) β€” tag: [friend]. returns true if the iterators refer to the same stream, or are both at end-of-stream. friendship ended with everything else, now operator== 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