[range.transform.view]

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

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.transform.view)

### 25.7.9 Transform view [[range.transform]](range.transform#view)

#### 25.7.9.2 Class template transform_view [range.transform.view]

[ð](#lib:transform_view)

namespace std::ranges {template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") V, [move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_­constructible [concept.moveconstructible]") F>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V> && is_object_v<F> &&[regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<F&, range_reference_t<V>> &&[*can-reference*](iterator.synopsis#concept:can-reference "24.2 Header <iterator>&nbsp;synopsis [iterator.synopsis]")<invoke_result_t<F&, range_reference_t<V>>>class transform_view : public view_interface<transform_view<V, F>> {private:// [[range.transform.iterator]](range.transform.iterator "25.7.9.3 Class template transform_­view​::​iterator"), class template transform_view​::​*iterator*template<bool> struct *iterator*; // *exposition only*// [[range.transform.sentinel]](range.transform.sentinel "25.7.9.4 Class template transform_­view​::​sentinel"), class template transform_view​::​*sentinel*template<bool> struct *sentinel*; // *exposition only* V *base_* = V(); // *exposition only**movable-box*<F> *fun_*; // *exposition only*public: transform_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<V> && [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<F> = default; constexpr explicit transform_view(V base, F fun); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr *iterator*<false> begin(); constexpr *iterator*<true> begin() constrequires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V> &&[regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>; constexpr *sentinel*<false> end(); constexpr *iterator*<false> end() requires [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V>; constexpr *sentinel*<true> end() constrequires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V> &&[regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>; constexpr *iterator*<true> end() constrequires [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<const V> &&[regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>; constexpr auto size() requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V> { return ranges::size(*base_*); }constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<const V>{ return ranges::size(*base_*); }constexpr auto reserve_hint() requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<V>{ return ranges::reserve_hint(*base_*); }constexpr auto reserve_hint() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<const V>{ return ranges::reserve_hint(*base_*); }}; template<class R, class F> transform_view(R&&, F) -> transform_view<views::all_t<R>, F>;}

[ð](#lib:transform_view,constructor)

`constexpr explicit transform_view(V base, F fun);
`

[1](#1)

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

*Effects*: Initializes *base_* with std​::​move(base) and*fun_* with std​::​move(fun)[.](#1.sentence-1)

[ð](#lib:begin,transform_view)

`constexpr iterator<false> begin();
`

[2](#2)

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

*Effects*: Equivalent to:return *iterator*<false>{*this, ranges::begin(*base_*)};

[ð](#lib:begin,transform_view_)

`constexpr iterator<true> begin() const
  requires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V> &&
           [regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>;
`

[3](#3)

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

*Effects*: Equivalent to:return *iterator*<true>{*this, ranges::begin(*base_*)};

[ð](#lib:end,transform_view)

`constexpr sentinel<false> end();
`

[4](#4)

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

*Effects*: Equivalent to:return *sentinel*<false>{ranges::end(*base_*)};

[ð](#lib:end,transform_view_)

`constexpr iterator<false> end() requires [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V>;
`

[5](#5)

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

*Effects*: Equivalent to:return *iterator*<false>{*this, ranges::end(*base_*)};

[ð](#lib:end,transform_view__)

`constexpr sentinel<true> end() const
  requires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V> &&
           [regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>;
`

[6](#6)

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

*Effects*: Equivalent to:return *sentinel*<true>{ranges::end(*base_*)};

[ð](#lib:end,transform_view___)

`constexpr iterator<true> end() const
  requires [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<const V> &&
           [regular_invocable](concept.regularinvocable#concept:regular_invocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]")<const F&, range_reference_t<const V>>;
`

[7](#7)

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

*Effects*: Equivalent to:return *iterator*<true>{*this, ranges::end(*base_*)};
