25 Ranges library [ranges]

25.6 Range factories [range.factories]

25.6.5 Repeat view [range.repeat]

25.6.5.2 Class template repeat_view [range.repeat.view]

namespace std::ranges { template<class T> concept integer-like-with-usable-difference-type = / exposition only is-signed-integer-like<T> || (is-integer-like<T> && weakly_incrementable<T>); template<move_constructible T, semiregular Bound = unreachable_sentinel_t> requires (is_object_v<T> && same_as<T, remove_cv_t<T>> && (integer-like-with-usable-difference-type<Bound> || same_as<Bound, unreachable_sentinel_t>) class repeat_view : public view_interface<repeat_view<T, Bound>> { private: / [range.repeat.iterator], class repeat_view​::​iterator struct iterator; / exposition only movable-box<T> value_; / exposition only, see [range.move.wrap] Bound bound_ = Bound(); / exposition only public: repeat_view() requires default_initializable<T> = default; constexpr explicit repeat_view(const T& value, Bound bound = Bound() requires copy_constructible<T>; constexpr explicit repeat_view(T&& value, Bound bound = Bound(); template<class. TArgs, class. BoundArgs> requires constructible_from<T, TArgs..> && constructible_from<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<Bound, unreachable_sentinel_t>); constexpr unreachable_sentinel_t end() const noexcept; constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>); }; template<class T, class Bound = unreachable_sentinel_t> repeat_view(T, Bound = Bound() -> repeat_view<T, Bound>; }
constexpr explicit repeat_view(const T& value, Bound bound = Bound() requires copy_constructible<T>;
Preconditions: If Bound is not unreachable_sentinel_t, bound  ≥ 0.
Effects: Initializes value_ with value and bound_ with bound.
constexpr explicit repeat_view(T&& value, Bound bound = Bound();
Effects: Initializes value_ with std​::​move(value) and bound_ with bound.
template<class. TArgs, class. BoundArgs> requires constructible_from<T, TArgs..> && constructible_from<Bound, BoundArgs..> constexpr explicit repeat_view(piecewise_construct_t, tuple<TArgs..> value_args, tuple<BoundArgs..> bound_args = tuple<>{});
Effects: Initializes value_ with make_from_tuple<T>(std​::​move(value_args)) and initializes bound_ with make_from_tuple<Bound>(std​::​move(bound_args)).
The behavior is undefined if Bound is not unreachable_sentinel_t and bound_ is negative.
constexpr iterator begin() const;
Effects: Equivalent to: return iterator(addressof(*value_);
constexpr iterator end() const requires (!same_as<Bound, unreachable_sentinel_t>);
Effects: Equivalent to: return iterator(addressof(*value_), bound_);
constexpr unreachable_sentinel_t end() const noexcept;
Effects: Equivalent to: return unreachable_sentinel;
constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
Effects: Equivalent to: return to-unsigned-like(bound_);

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant