[range.repeat.view]

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

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

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

#### 25.6.5.2 Class template repeat_view [range.repeat.view]

namespace std::ranges {template<class T>concept [*integer-like-with-usable-difference-type*](#concept:integer-like-with-usable-difference-type "25.6.5.2 Class template repeat_­view [range.repeat.view]") = // *exposition only**is-signed-integer-like*<T> || (*is-integer-like*<T> && [weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4 Concept weakly_­incrementable [iterator.concept.winc]")<T>); 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 = unreachable_sentinel_t>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*](#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](#lib:repeat_view "25.6.5.2 Class template repeat_­view [range.repeat.view]") : public view_interface<repeat_view<T, Bound>> {private:// [[range.repeat.iterator]](range.repeat.iterator "25.6.5.3 Class repeat_­view​::​iterator"), class repeat_view​::​*iterator*struct *iterator*; // *exposition only**movable-box*<T> *value_*; // *exposition only*, see [[range.move.wrap]](range.move.wrap "25.7.3 Movable wrapper") Bound *bound_* = Bound(); // *exposition only*public: repeat_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<T> = default; constexpr explicit repeat_view(const T& value, Bound bound = Bound())requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<T>; constexpr explicit repeat_view(T&& value, Bound bound = Bound()); template<class... TArgs, class... BoundArgs>requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<T, TArgs...> &&[constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<Bound, BoundArgs...>constexpr explicit repeat_view(piecewise_construct_t,
 tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{}); constexpr *iterator* begin() const; constexpr *iterator* end() const requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>); constexpr unreachable_sentinel_t end() const noexcept; constexpr auto size() const requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>); }; template<class T, class Bound = unreachable_sentinel_t> repeat_view(T, Bound = Bound()) -> repeat_view<T, Bound>;}

[ð](#lib:repeat_view,constructor)

`constexpr explicit repeat_view(const T& value, Bound bound = Bound())
  requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<T>;
`

[1](#1)

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

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

[2](#2)

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

*Effects*: Initializes *value_* with value and*bound_* with bound[.](#2.sentence-1)

[ð](#lib:repeat_view,constructor_)

`constexpr explicit repeat_view(T&& value, Bound bound = Bound());
`

[3](#3)

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

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

[4](#4)

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

*Effects*: Initializes *value_* with std​::​move(value) and*bound_* with bound[.](#4.sentence-1)

[ð](#lib:repeat_view,constructor__)

`template<class... TArgs, class... BoundArgs>
  requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<T, TArgs...> &&
           [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<Bound, BoundArgs...>
constexpr explicit repeat_view(piecewise_construct_t,
  tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
`

[5](#5)

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

*Effects*: Initializes *value_* withmake_from_tuple<T>(std​::​move(value_args)) and
initializes *bound_* withmake_from_tuple<Bound>(std​::​move(bound_args))[.](#5.sentence-1)

The behavior is undefined ifBound is not unreachable_sentinel_t and*bound_* is negative[.](#5.sentence-2)

[ð](#lib:begin,repeat_view)

`constexpr iterator begin() const;
`

[6](#6)

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

*Effects*: Equivalent to: return *iterator*(addressof(**value_*));

[ð](#lib:end,repeat_view)

`constexpr iterator end() const requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>);
`

[7](#7)

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

*Effects*: Equivalent to: return *iterator*(addressof(**value_*), *bound_*);

[ð](#lib:end,repeat_view_)

`constexpr unreachable_sentinel_t end() const noexcept;
`

[8](#8)

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

*Effects*: Equivalent to: return unreachable_sentinel;

[ð](#lib:size,repeat_view)

`constexpr auto size() const requires (![same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<Bound, unreachable_sentinel_t>);
`

[9](#9)

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

*Effects*: Equivalent to: return *to-unsigned-like*(*bound_*);
