Iterators(3)
π 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 tostd::__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
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms