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

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

πŸ’– NAME πŸ’–

std::ranges::zip_transform_view::iterator β€” that's the whole name, bestie, it's literally std::ranges::zip_transform_view::iterator, iconic and long and we respect it πŸŽ€


✨ Synopsis ✨

template< bool Const >  (since C++23)
class /*iterator*/;     (exposition only*)

Ok so picture this: it's the iterator type of a possibly const-qualified zip_transform_view, and you get one back from zip_transform_view::begin and, in certain cases, from zip_transform_view::end. Slay.

And the tea on the template param: 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 πŸ¦‹


🌸 Member types 🌸

  • Parent (private) β€” zip_transform_view if Const is false, const zip_transform_view otherwise. (exposition-only member type*)
  • Base (private) β€” InnerView if Const is false, const InnerView otherwise. (exposition-only member type*)

Bestie, before we go any further, two little "let" definitions that everything else leans on:

Let /*maybe-const*/<Const, F>& denote const F& if Const is true, F& otherwise.

Let /*maybe-const*/<Const, Views> denote const Views if Const is true, Views otherwise.

Let /*POT*/ denote the pack of types std::iterator_traits<std::iterator_t</*maybe-const*/<Const, Views>>>::iterator_category...

Now the actual members:

  • iterator_category (optional) β€” this one has layers, ok? Hold my hand:

If /*Base*/ models forward_range, then iterator_category denotes:

  • std::input_iterator_tag, if std::invoke_result_t</*maybe-const*/<Const, F>&, ranges::range_reference_t</*maybe-const*/<Const, Views>>...> is not a reference.
  • Otherwise,
    • std::random_access_iterator_tag, if (std::derived_from</*POT*/, std::random_access_iterator_tag> && ...) is true.
    • Otherwise, std::bidirectional_iterator_tag, if (std::derived_from</*POT*/, std::bidirectional_iterator_tag> && ...) is true.
    • Otherwise, std::forward_iterator_tag, if (std::derived_from</*POT*/, std::forward_iterator_tag> && ...) is true.
    • Otherwise, std::input_iterator_tag.
Heads up: it is not present if /*Base*/ does not model forward_range. Not me showing up with no iterator_category, embarrassing πŸ’€
  • iterator_concept β€” /*ziperator*/<Const>::iterator_concept. That's it, that's the definition 🫢
  • value_type β€” let /*RREF*/ be ranges::range_reference_t<Views>..., and /*CRREF*/ be ranges::range_reference_t<const Views>.... Then:
    • std::remove_cvref_t<std::invoke_result_t<F&, /*RREF*/>> if Const is false,
    • std::remove_cvref_t<std::invoke_result_t<const F&, /*CRREF*/>> otherwise.
  • difference_type β€” range::range_difference_t</*Base*/>> β€” well, exactly range::range_difference_t</*Base*/> πŸ‘‘

πŸ¦‹ Data members πŸ¦‹

  • parent_ (private) β€” a pointer Parent* to the parent object. (exposition-only member object*)
  • inner_ (private) β€” an iterator of type ziperator<Const>. (exposition-only member type*)

πŸ’… Member functions πŸ’…

  • constructor (C++23) β€” constructs an iterator. (public member function)
  • operator* (C++23) β€” obtains the result of applying the invocable object to the underlying pointed-to elements. (public member function)
  • operator[] (C++23) β€” obtains the result of applying the invocable object to the underlying elements at given offset. (public member function)
  • operator++, operator++(int), operator--, operator--(int), operator+=, operator-= (C++23) β€” advances or decrements the underlying iterator. (public member function)

πŸ”₯ Non-member functions πŸ”₯

  • operator==, operator<=> (C++23) β€” compares the underlying iterators. (function)
  • operator+, operator- (C++23) β€” performs iterator arithmetic on underlying iterators. (function)

πŸ₯Ί Example πŸ₯Ί

This section is incomplete.

Reason: no example.

Not the "no example" arc 😭 we're all rooting for you, example section. You'll get there.

πŸ“ Category πŸ“

  • Todo no example

Lowkey a whole journey, ngl β€” but you ate that, bestie πŸ’œ This gem came straight from http://cppreference.com, dated 2024.06.10, on the std::ranges...ew::iterator(3) page in the C++ Standard Library manual. Go forth and zip-transform, you main character βœ¨πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from