From Jason Turner

[range.repeat.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp75i0oxvv/{from.md → to.md} +105 -0
tmp/tmp75i0oxvv/{from.md → to.md} RENAMED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `repeat_view` <a id="range.repeat.view">[[range.repeat.view]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<class T>
6
+ concept integer-like-with-usable-difference-type = // exposition only
7
+ is-signed-integer-like<T> || (is-integer-like<T> && weakly_incrementable<T>);
8
+
9
+ template<move_constructible T, semiregular Bound = unreachable_sentinel_t>
10
+ requires (is_object_v<T> && same_as<T, remove_cv_t<T>> &&
11
+ (integer-like-with-usable-difference-type<Bound> ||
12
+ same_as<Bound, unreachable_sentinel_t>))
13
+ class repeat_view : public view_interface<repeat_view<T, Bound>> {
14
+ private:
15
+ // [range.repeat.iterator], class repeat_view::iterator
16
+ struct iterator; // exposition only
17
+
18
+ movable-box<T> value_; // exposition only, see [range.move.wrap]
19
+ Bound bound_ = Bound(); // exposition only
20
+
21
+ public:
22
+ repeat_view() requires default_initializable<T> = default;
23
+
24
+ constexpr explicit repeat_view(const T& value, Bound bound = Bound())
25
+ requires copy_constructible<T>;
26
+ constexpr explicit repeat_view(T&& value, Bound bound = Bound());
27
+ template<class... TArgs, class... BoundArgs>
28
+ requires constructible_from<T, TArgs...> &&
29
+ constructible_from<Bound, BoundArgs...>
30
+ constexpr explicit repeat_view(piecewise_construct_t,
31
+ tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
32
+
33
+ constexpr iterator begin() const;
34
+ constexpr iterator end() const requires (!same_as<Bound, unreachable_sentinel_t>);
35
+ constexpr unreachable_sentinel_t end() const noexcept;
36
+
37
+ constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
38
+ };
39
+
40
+ template<class T, class Bound>
41
+ repeat_view(T, Bound) -> repeat_view<T, Bound>;
42
+ }
43
+ ```
44
+
45
+ ``` cpp
46
+ constexpr explicit repeat_view(const T& value, Bound bound = Bound())
47
+ requires copy_constructible<T>;
48
+ ```
49
+
50
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`,
51
+ `bound` ≥ 0.
52
+
53
+ *Effects:* Initializes *value\_* with `value` and *bound\_* with
54
+ `bound`.
55
+
56
+ ``` cpp
57
+ constexpr explicit repeat_view(T&& value, Bound bound = Bound());
58
+ ```
59
+
60
+ *Preconditions:* If `Bound` is not `unreachable_sentinel_t`,
61
+ `bound` ≥ 0.
62
+
63
+ *Effects:* Initializes *value\_* with `std::move(value)` and *bound\_*
64
+ with `bound`.
65
+
66
+ ``` cpp
67
+ template<class... TArgs, class... BoundArgs>
68
+ requires constructible_from<T, TArgs...> &&
69
+ constructible_from<Bound, BoundArgs...>
70
+ constexpr explicit repeat_view(piecewise_construct_t,
71
+ tuple<TArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
72
+ ```
73
+
74
+ *Effects:* Initializes *value\_* with
75
+ `make_from_tuple<T>(std::move(value_args))` and initializes *bound\_*
76
+ with `make_from_tuple<Bound>(std::move(bound_args))`. The behavior is
77
+ undefined if `Bound` is not `unreachable_sentinel_t` and *bound\_* is
78
+ negative.
79
+
80
+ ``` cpp
81
+ constexpr iterator begin() const;
82
+ ```
83
+
84
+ *Effects:* Equivalent to:
85
+ `return `*`iterator`*`(addressof(*`*`value_`*`));`
86
+
87
+ ``` cpp
88
+ constexpr iterator end() const requires (!same_as<Bound, unreachable_sentinel_t>);
89
+ ```
90
+
91
+ *Effects:* Equivalent to:
92
+ `return `*`iterator`*`(addressof(*`*`value_`*`), `*`bound_`*`);`
93
+
94
+ ``` cpp
95
+ constexpr unreachable_sentinel_t end() const noexcept;
96
+ ```
97
+
98
+ *Effects:* Equivalent to: `return unreachable_sentinel;`
99
+
100
+ ``` cpp
101
+ constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
102
+ ```
103
+
104
+ *Effects:* Equivalent to: `return `*`to-unsigned-like`*`(`*`bound_`*`);`
105
+