From Jason Turner

[range.adjacent.sentinel]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp87vck63n/{from.md → to.md} +76 -0
tmp/tmp87vck63n/{from.md → to.md} RENAMED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `adjacent_view::sentinel` <a id="range.adjacent.sentinel">[[range.adjacent.sentinel]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<forward_range V, size_t N>
6
+ requires view<V> && (N > 0)
7
+ template<bool Const>
8
+ class adjacent_view<V, N>::sentinel {
9
+ using Base = maybe-const<Const, V>; // exposition only
10
+ sentinel_t<Base> end_ = sentinel_t<Base>(); // exposition only
11
+ constexpr explicit sentinel(sentinel_t<Base> end); // exposition only
12
+
13
+ public:
14
+ sentinel() = default;
15
+ constexpr sentinel(sentinel<!Const> i)
16
+ requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
17
+
18
+ template<bool OtherConst>
19
+ requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
20
+ friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
21
+
22
+ template<bool OtherConst>
23
+ requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
24
+ friend constexpr range_difference_t<maybe-const<OtherConst, V>>
25
+ operator-(const iterator<OtherConst>& x, const sentinel& y);
26
+
27
+ template<bool OtherConst>
28
+ requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
29
+ friend constexpr range_difference_t<maybe-const<OtherConst, V>>
30
+ operator-(const sentinel& y, const iterator<OtherConst>& x);
31
+ };
32
+ }
33
+ ```
34
+
35
+ ``` cpp
36
+ constexpr explicit sentinel(sentinel_t<Base> end);
37
+ ```
38
+
39
+ *Effects:* Initializes *end\_* with `end`.
40
+
41
+ ``` cpp
42
+ constexpr sentinel(sentinel<!Const> i)
43
+ requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
44
+ ```
45
+
46
+ *Effects:* Initializes *end\_* with `std::move(i.`*`end_`*`)`.
47
+
48
+ ``` cpp
49
+ template<bool OtherConst>
50
+ requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
51
+ friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
52
+ ```
53
+
54
+ *Effects:* Equivalent to:
55
+ `return x.`*`current_`*`.back() == y.`*`end_`*`;`
56
+
57
+ ``` cpp
58
+ template<bool OtherConst>
59
+ requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
60
+ friend constexpr range_difference_t<maybe-const<OtherConst, V>>
61
+ operator-(const iterator<OtherConst>& x, const sentinel& y);
62
+ ```
63
+
64
+ *Effects:* Equivalent to:
65
+ `return x.`*`current_`*`.back() - y.`*`end_`*`;`
66
+
67
+ ``` cpp
68
+ template<bool OtherConst>
69
+ requires sized_sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
70
+ friend constexpr range_difference_t<maybe-const<OtherConst, V>>
71
+ operator-(const sentinel& y, const iterator<OtherConst>& x);
72
+ ```
73
+
74
+ *Effects:* Equivalent to:
75
+ `return y.`*`end_`*` - x.`*`current_`*`.back();`
76
+