[range.zip.transform.iterator]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.zip.transform.iterator)

### 25.7.26 Zip transform view [[range.zip.transform]](range.zip.transform#iterator)

#### 25.7.26.3 Class template zip_transform_view​::​*iterator* [range.zip.transform.iterator]

[ð](#lib:zip_transform_view::iterator)

namespace std::ranges {template<[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_­constructible [concept.moveconstructible]") F, [input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]")... Views>requires ([view](range.view#concept:view "25.4.5 Views [range.view]")<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&[regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<F&, range_reference_t<Views>...> &&[*can-reference*](iterator.synopsis#concept:can-reference "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]")<invoke_result_t<F&, range_reference_t<Views>...>>template<bool Const>class zip_transform_view<F, Views...>::*iterator* {using *Parent* = *maybe-const*<Const, zip_transform_view>; // *exposition only*using *Base* = *maybe-const*<Const, *InnerView*>; // *exposition only**Parent** *parent_* = nullptr; // *exposition only**ziperator*<Const> *inner_*; // *exposition only*constexpr *iterator*(*Parent*& parent, *ziperator*<Const> inner); // *exposition only*public:using iterator_category = *see below*; // not always presentusing iterator_concept = typename *ziperator*<Const>::iterator_concept; using value_type = remove_cvref_t<invoke_result_t<*maybe-const*<Const, F>&,
 range_reference_t<*maybe-const*<Const, Views>>...>>; using difference_type = range_difference_t<*Base*>; *iterator*() = default; constexpr *iterator*(*iterator*<!Const> i)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<*ziperator*<false>, *ziperator*<Const>>; constexpr decltype(auto) operator*() const noexcept(*see below*); constexpr *iterator*& operator++(); constexpr void operator++(int); constexpr *iterator* operator++(int) requires [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator*& operator--() requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator* operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator*& operator+=(difference_type x) requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr *iterator*& operator-=(difference_type x) requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; constexpr decltype(auto) operator[](difference_type n) constrequires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr bool operator==(const *iterator*& x, const *iterator*& y)requires [equality_comparable](concept.equalitycomparable#concept:equality_comparable "18.5.4 Concept equality_­comparable [concept.equalitycomparable]")<*ziperator*<Const>>; friend constexpr auto operator<=>(const *iterator*& x, const *iterator*& y)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr *iterator* operator+(const *iterator*& i, difference_type n)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr *iterator* operator+(difference_type n, const *iterator*& i)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr *iterator* operator-(const *iterator*& i, difference_type n)requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<*Base*>; friend constexpr difference_type operator-(const *iterator*& x, const *iterator*& y)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<*ziperator*<Const>, *ziperator*<Const>>; };}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12180)

The member [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*iterator*​::​iterator_category is defined if and only if *Base* models [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")[.](#1.sentence-1)

In that case,*iterator*​::​iterator_category is defined as follows:

- [(1.1)](#1.1)

Ifinvoke_result_t<*maybe-const*<Const, F>&, range_reference_t<*maybe-const*<Const, Views>>...> is not a reference,iterator_category denotes input_iterator_tag.

- [(1.2)](#1.2)

Otherwise, let Cs denote the pack of typesiterator_traits<iterator_t<*maybe-const*<Const, Views>>>​::​iterator_category....   * [(1.2.1)](#1.2.1)

      If ([derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_­from [concept.derived]")<Cs, random_access_iterator_tag> && ...) is true,iterator_category denotes random_access_iterator_tag[.](#1.2.1.sentence-1)

  * [(1.2.2)](#1.2.2)

      Otherwise,
if ([derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_­from [concept.derived]")<Cs, bidirectional_iterator_tag> && ...) is true,iterator_category denotes bidirectional_iterator_tag[.](#1.2.2.sentence-1)

  * [(1.2.3)](#1.2.3)

      Otherwise,
if ([derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_­from [concept.derived]")<Cs, forward_iterator_tag> && ...) is true,iterator_category denotes forward_iterator_tag[.](#1.2.3.sentence-1)

  * [(1.2.4)](#1.2.4)

      Otherwise, iterator_category denotes input_iterator_tag[.](#1.2.4.sentence-1)

[ð](#lib:zip_transform_view::iterator,constructor)

`constexpr iterator(Parent& parent, ziperator<Const> inner);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12223)

*Effects*: Initializes *parent_* with addressof(parent) and*inner_* with std​::​move(inner)[.](#2.sentence-1)

[ð](#lib:zip_transform_view::iterator,constructor_)

`constexpr iterator(iterator<!Const> i)
  requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<ziperator<false>, ziperator<Const>>;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12236)

*Effects*: Initializes *parent_* with i.*parent_* and*inner_* with std​::​move(i.*inner_*)[.](#3.sentence-1)

[ð](#lib:operator*,zip_transform_view::iterator)

`constexpr decltype(auto) operator*() const noexcept(see below);
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12248)

*Effects*: Equivalent to:return apply([&](const auto&... iters) -> decltype(auto) {return invoke(**parent_*->*fun_*, *iters...);}, *inner_*.*current_*);

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12257)

*Remarks*: Let Is be the pack 0, 1, …, (sizeof...(Views) - 1)[.](#5.sentence-1)

The exception specification is equivalent to:noexcept(invoke(**parent_*->*fun_*, *std​::​get<Is>(*inner_*.*current_*)...))[.](#5.sentence-2)

[ð](#lib:operator++,zip_transform_view::iterator)

`constexpr iterator& operator++();
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12270)

*Effects*: Equivalent to:++*inner_*;return *this;

[ð](#lib:operator++,zip_transform_view::iterator_)

`constexpr void operator++(int);
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12285)

*Effects*: Equivalent to: ++*this[.](#7.sentence-1)

[ð](#lib:operator++,zip_transform_view::iterator__)

`constexpr iterator operator++(int) requires [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12296)

*Effects*: Equivalent to:auto tmp = *this;++*this;return tmp;

[ð](#lib:operator--,zip_transform_view::iterator)

`constexpr iterator& operator--() requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12312)

*Effects*: Equivalent to:--*inner_*;return *this;

[ð](#lib:operator--,zip_transform_view::iterator_)

`constexpr iterator operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12327)

*Effects*: Equivalent to:auto tmp = *this;--*this;return tmp;

[ð](#lib:operator+=,zip_transform_view::iterator)

`constexpr iterator& operator+=(difference_type x)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12344)

*Effects*: Equivalent to:*inner_* += x;return *this;

[ð](#lib:operator+=,zip_transform_view::iterator_)

`constexpr iterator& operator-=(difference_type x)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12360)

*Effects*: Equivalent to:*inner_* -= x;return *this;

[ð](#lib:operator%5b%5d,zip_transform_view::iterator)

`constexpr decltype(auto) operator[](difference_type n) const
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[13](#13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12376)

*Effects*: Equivalent to:return apply([&]<class... Is>(const Is&... iters) -> decltype(auto) {return invoke(**parent_*->*fun_*, iters[iter_difference_t<Is>(n)]...);}, *inner_*.*current_*);

[ð](#lib:operator==,zip_transform_view::iterator)

`friend constexpr bool operator==(const iterator& x, const iterator& y)
  requires [equality_comparable](concept.equalitycomparable#concept:equality_comparable "18.5.4 Concept equality_­comparable [concept.equalitycomparable]")<ziperator<Const>>;
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[14](#14)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12395)

Let *op* be the operator[.](#14.sentence-1)

[15](#15)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12398)

*Effects*: Equivalent to:return x.*inner_* *op* y.*inner_*;

[ð](#lib:operator+,zip_transform_view::iterator)

`friend constexpr iterator operator+(const iterator& i, difference_type n)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
friend constexpr iterator operator+(difference_type n, const iterator& i)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[16](#16)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12413)

*Effects*: Equivalent to:return *iterator*(*i.*parent_*, i.*inner_* + n);

[ð](#lib:operator-,zip_transform_view::iterator)

`friend constexpr iterator operator-(const iterator& i, difference_type n)
  requires [random_access_range](range.refinements#concept:random_access_range "25.4.6 Other range refinements [range.refinements]")<Base>;
`

[17](#17)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12426)

*Effects*: Equivalent to:return *iterator*(*i.*parent_*, i.*inner_* - n);

[ð](#lib:operator-,zip_transform_view::iterator_)

`friend constexpr difference_type operator-(const iterator& x, const iterator& y)
  requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_­sentinel_­for [iterator.concept.sizedsentinel]")<ziperator<Const>, ziperator<Const>>;
`

[18](#18)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L12439)

*Effects*: Equivalent to:return x.*inner_* - y.*inner_*;
