std::ranges...ew::iterator(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::ranges::zip_view::iterator β€” a (3) page from the C++ Standard Library manual, bestie

okay so real talk, this is the <pink>C++ Standard Library</pink> section 3 page for std::ranges::zip_view::iterator, and honestly? it's giving iterator royalty. let me walk you through it 🫢


✨ NAME ✨

std::ranges::zip_view::iterator β€” literally the std::ranges::zip_view::iterator, that's the whole name, periodt πŸ’…


🌸 SYNOPSIS 🌸

so first up we got the class template itself:

   template< bool Const >
(1) (exposition
   class /*iterator*/;
only*)

then the helper concepts πŸ’– β€” these are the little sidekicks that make everything work:

   template< bool C, class... Views >

   concept /*all-forward*/ =
(2) (exposition
                                                              only*)
       (ranges::forward_range<std::conditional_t<C, const Views,
   Views>> && ...);
   template< bool C, class... Views >

   concept /*all-bidirectional*/ =
(3) (exposition
                                                              only*)
       (ranges::bidirectional_range<std::conditional_t<C, const Views,
   Views>> && ...);
   template< bool C, class... Views >

   concept /*all-random-access*/ =
(4) (exposition
                                                              only*)
       (ranges::random_access_range<std::conditional_t<C, const Views,
   Views>> && ...);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: this is the iterator type of a possibly const-qualified zip_view, and it gets returned by zip_view::begin and, in certain cases, by zip_view::end. yes she's popular, she gets around πŸ‘‘

and the type /*iterator*/<true> or /*iterator*/<false> treats the underlying views as const-qualified or non-const-qualified respectively. that's the whole vibe check right there, no cap.


πŸ’œ MEMBER TYPES πŸ’œ

  • iterator_concept β€” here's the priority ladder, bestie, it works its way down:
    • std::random_access_iterator_tag if /*all-random-access*/<Const, Views...> is true, otherwise
    • std::bidirectional_iterator_tag if /*all-bidirectional*/<Const, Views...> is true, otherwise
    • std::forward_iterator_tag if /*all-forward*/<Const, Views...> is true, otherwise
    • std::input_iterator_tag
  • iterator_category β€”
    • std::input_iterator_tag if /*all-forward*/<Const, Views...> is true,
    • not defined otherwise
  • value_type β€”
    • std::tuple<ranges::range_value_t<Views>...> if Const is false,
    • std::tuple<ranges::range_value_t<const Views>...> otherwise.
  • difference_type β€”
    • std::common_type_t<ranges::range_difference_t<Views>...> if Const is false,
    • std::common_type_t<ranges::range_difference_t<const Views>...> otherwise.

πŸŽ€ DATA MEMBERS πŸŽ€

  • current_ (private) β€” a tuple of underlying iterators of type std::tuple<ranges::iterator_t<Views>...> or std::tuple<ranges::iterator_t<const Views>...> when Const is false or true respectively. also flagged as an (exposition-only member object*), iykyk 🌈

⭐ MEMBER FUNCTIONS ⭐

  • constructor (C++23) β€” constructs an iterator (public member function)
  • operator* (C++23) β€” obtains a tuple-like value that consists of underlying pointed-to elements (public member function)
  • operator[] (C++23) β€” obtains a tuple-like value that consists of underlying elements at given offset (public member function)
  • operator++, operator++(int), operator--, operator--(int), operator+=, operator-= (C++23) β€” advances or decrements the underlying iterators (public member function)

πŸ”₯ NON-MEMBER FUNCTIONS πŸ”₯

  • operator==, operator<, operator>, operator<=, operator>=, operator<=> (C++23) β€” compares the underlying iterators (function)
  • operator+, operator- (C++23) β€” performs iterator arithmetic on underlying iterators (function)
  • iter_move (C++23) β€” obtains a tuple-like value that denotes underlying pointed-to elements to be moved (function)
  • iter_swap (C++23) β€” swaps underlying pointed-to elements (function)

πŸ’€ real talk: iterator_category is not defined when /*all-forward*/<Const, Views...> is false. not "defined as something else", not "defined-ish" β€” not defined, periodt. don't come for her.

🧚 SIGN-OFF 🧚

that's the whole page, bestie! this one came from http://cppreference.com, dated 2024.06.10, and it's the std::ranges...ew::iterator(3) page β€” go forth and zip your views, you absolute icon πŸ“πŸ’–βœ¨

πŸ“¦ where this page comes from