[range.repeat.iterator]

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

## 25.6 Range factories [[range.factories]](range.factories#range.repeat.iterator)

### 25.6.5 Repeat view [[range.repeat]](range.repeat#iterator)

#### 25.6.5.3 Class repeat_view​::​*iterator* [range.repeat.iterator]

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

namespace std::ranges {template<[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_­constructible [concept.moveconstructible]") T, [semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") Bound>requires (is_object_v<T> && [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<T, remove_cv_t<T>> &&([*integer-like-with-usable-difference-type*](range.repeat.view#concept:integer-like-with-usable-difference-type "25.6.5.2 Class template repeat_­view [range.repeat.view]")<Bound> ||[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>))class repeat_view<T, Bound>::*iterator* {private:using *index-type* = // *exposition only* conditional_t<[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>, ptrdiff_t, Bound>; const T* *value_* = nullptr; // *exposition only**index-type* *current_* = *index-type*(); // *exposition only*constexpr explicit *iterator*(const T* value, *index-type* b = *index-type*()); // *exposition only*public:using iterator_concept = random_access_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = T; using difference_type = *see below*; *iterator*() = default; constexpr const T& operator*() const noexcept; constexpr *iterator*& operator++(); constexpr *iterator* operator++(int); constexpr *iterator*& operator--(); constexpr *iterator* operator--(int); constexpr *iterator*& operator+=(difference_type n); constexpr *iterator*& operator-=(difference_type n); constexpr const T& operator[](difference_type n) const noexcept; friend constexpr bool operator==(const *iterator*& x, const *iterator*& y); friend constexpr auto operator<=>(const *iterator*& x, const *iterator*& y); friend constexpr *iterator* operator+(*iterator* i, difference_type n); friend constexpr *iterator* operator+(difference_type n, *iterator* i); friend constexpr *iterator* operator-(*iterator* i, difference_type n); friend constexpr difference_type operator-(const *iterator*& x, const *iterator*& y); };}

[1](#1)

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

If *is-signed-integer-like*<*index-type*> is true,
the member [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") difference_type denotes *index-type*[.](#1.sentence-1)

Otherwise, it denotes *IOTA-DIFF-T*(*index-type*) ([[range.iota.view]](range.iota.view "25.6.4.2 Class template iota_­view"))[.](#1.sentence-2)

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

`constexpr explicit iterator(const T* value, index-type b = index-type());
`

[2](#2)

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

*Preconditions*: If Bound is not unreachable_sentinel_t, b â¥ 0[.](#2.sentence-1)

[3](#3)

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

*Effects*: Initializes *value_* with value and*current_* with b[.](#3.sentence-1)

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

`constexpr const T& operator*() const noexcept;
`

[4](#4)

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

*Effects*: Equivalent to: return **value_*;

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

`constexpr iterator& operator++();
`

[5](#5)

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

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

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

`constexpr iterator operator++(int);
`

[6](#6)

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

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

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

`constexpr iterator& operator--();
`

[7](#7)

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

*Preconditions*: If Bound is not unreachable_sentinel_t,current_>0[.](#7.sentence-1)

[8](#8)

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

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

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

`constexpr iterator operator--(int);
`

[9](#9)

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

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

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

`constexpr iterator& operator+=(difference_type n);
`

[10](#10)

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

*Preconditions*: If Bound is not unreachable_sentinel_t,current_+nâ¥0[.](#10.sentence-1)

[11](#11)

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

*Effects*: Equivalent to:*current_* += n;return *this;

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

`constexpr iterator& operator-=(difference_type n);
`

[12](#12)

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

*Preconditions*: If Bound is not unreachable_sentinel_t,current_ânâ¥0[.](#12.sentence-1)

[13](#13)

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

*Effects*: Equivalent to:*current_* -= n;return *this;

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

`constexpr const T& operator[](difference_type n) const noexcept;
`

[14](#14)

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

*Effects*: Equivalent to: return *(*this + n);

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

`friend constexpr bool operator==(const iterator& x, const iterator& y);
`

[15](#15)

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

*Effects*: Equivalent to: return x.*current_* == y.*current_*;

[ð](#lib:operator%3c=%3e,repeat_view::iterator)

`friend constexpr auto operator<=>(const iterator& x, const iterator& y);
`

[16](#16)

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

*Effects*: Equivalent to: return x.*current_* <=> y.*current_*;

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

`friend constexpr iterator operator+(iterator i, difference_type n);
friend constexpr iterator operator+(difference_type n, iterator i);
`

[17](#17)

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

*Effects*: Equivalent to:i += n;return i;

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

`friend constexpr iterator operator-(iterator i, difference_type n);
`

[18](#18)

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

*Effects*: Equivalent to:i -= n;return i;

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

`friend constexpr difference_type operator-(const iterator& x, const iterator& y);
`

[19](#19)

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

*Effects*: Equivalent to:return static_cast<difference_type>(x.*current_*) - static_cast<difference_type>(y.*current_*);
