Iterators(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay so welcome to Iterators(3) from the Library Functions Manual β€” this is the page where C++ iterator tags get to be the main characters πŸ’…. The name on the cover is literally Iterators, and the cast is a bunch of tag structs plus one internal helper function. iykyk.

🧸 Classes 🧸

  • struct std::bidirectional_iterator_tag β€” bestie, bidirectional iterators support a superset of forward iterator operations. slay.
  • struct std::forward_iterator_tag β€” forward iterators support a superset of input iterator operations. periodt.
  • struct std::input_iterator_tag β€” marking input iterators. that’s the whole job.
  • struct std::iterator< _Category, _Tp, _Distance, _Pointer, _Reference > β€” the common iterator class, iconic in its simplicity.
  • struct std::iterator_traits< _Iterator > β€” it’s in the list, and that’s all the original page gives us, so no invented lore πŸ™ˆ.
  • struct std::output_iterator_tag β€” marking output iterators. yes bestie.
  • struct std::random_access_iterator_tag β€” random-access iterators support a superset of bidirectional iterator operations. she ate.

✨ Functions ✨

  • template<typename _Iter > iterator_traits< _Iter >::iterator_category β€” this one belongs to std::__iterator_category (const _Iter &). cute.

🌸 Detailed Description 🌸

okay so here’s the tea: these are empty types, used to distinguish different iterators. The distinction is not made by what they contain β€” it’s simply made by what they are. no cap. Then different underlying algorithms can be used based on the different operations supported by different iterator types. that’s the whole point, and it’s lowkey elegant.


πŸ’– Function Documentation πŸ’–

template<typename _Iter > iterator_traits<_Iter>::iterator_category

std::__iterator_category (const _Iter &) [inline]

bestie, heads up: this function is not a part of the C++ standard, but it is syntactic sugar for internal library use only. so don’t go treating it like public standard API. πŸ’€

Definition at line 160 of file stl_iterator_base_types.h.

Referenced by std::advance(), std::copy_n(), __gnu_cxx::copy_n(), std::distance(), __gnu_cxx::distance(), std::find(), std::find_end(), std::find_if(), std::find_if_not(), std::partition(), std::reverse(), std::search_n(), std::uninitialized_copy_n(), __gnu_cxx::uninitialized_copy_n(), and std::unique_copy().


πŸ‘‘ Author πŸ‘‘

This page was generated automatically by Doxygen for libstdc++ from the source code.


mwah πŸ’‹ β€” signing off with libstdc++, dated 21 Apr 2009, on the Iterators(3) page. byeeeee bestie 🫢✨

πŸ“¦ where this page comes from