From Jason Turner

[range.split.inner]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzwubo58h/{from.md → to.md} +125 -0
tmp/tmpzwubo58h/{from.md → to.md} RENAMED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class template `split_view::inner-iterator` <a id="range.split.inner">[[range.split.inner]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<input_range V, forward_range Pattern>
6
+ requires view<V> && view<Pattern> &&
7
+ indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
8
+ (forward_range<V> || tiny-range<Pattern>)
9
+ template<bool Const>
10
+ struct split_view<V, Pattern>::inner-iterator {
11
+ private:
12
+ using Base = conditional_t<Const, const V, V>; // exposition only
13
+ outer-iterator<Const> i_ = outer-iterator<Const>(); // exposition only
14
+ bool incremented_ = false; // exposition only
15
+ public:
16
+ using iterator_concept = typename outer-iterator<Const>::iterator_concept;
17
+ using iterator_category = see below;
18
+ using value_type = range_value_t<Base>;
19
+ using difference_type = range_difference_t<Base>;
20
+
21
+ inner-iterator() = default;
22
+ constexpr explicit inner-iterator(outer-iterator<Const> i);
23
+
24
+ constexpr decltype(auto) operator*() const { return *i_.current; }
25
+
26
+ constexpr inner-iterator& operator++();
27
+ constexpr decltype(auto) operator++(int) {
28
+ if constexpr (forward_range<V>) {
29
+ auto tmp = *this;
30
+ ++*this;
31
+ return tmp;
32
+ } else
33
+ ++*this;
34
+ }
35
+
36
+ friend constexpr bool operator==(const inner-iterator& x, const inner-iterator& y)
37
+ requires forward_range<Base>;
38
+
39
+ friend constexpr bool operator==(const inner-iterator& x, default_sentinel_t);
40
+
41
+ friend constexpr decltype(auto) iter_move(const inner-iterator& i)
42
+ noexcept(noexcept(ranges::iter_move(i.i_.current))) {
43
+ return ranges::iter_move(i.i_.current);
44
+ }
45
+
46
+ friend constexpr void iter_swap(const inner-iterator& x, const inner-iterator& y)
47
+ noexcept(noexcept(ranges::iter_swap(x.i_.current, y.i_.current)))
48
+ requires indirectly_swappable<iterator_t<Base>>;
49
+ };
50
+ }
51
+ ```
52
+
53
+ The *typedef-name* `iterator_category` denotes:
54
+
55
+ - `forward_iterator_tag` if
56
+ `iterator_traits<iterator_t<Base>>::iterator_category` models
57
+ `derived_from<forward_iterator_tag>`;
58
+ - otherwise, `iterator_traits<iterator_t<Base>>::iterator_category`.
59
+
60
+ ``` cpp
61
+ constexpr explicit inner-iterator(outer-iterator<Const> i);
62
+ ```
63
+
64
+ *Effects:* Initializes *i\_* with `std::move(i)`.
65
+
66
+ ``` cpp
67
+ constexpr inner-iterator& operator++();
68
+ ```
69
+
70
+ *Effects:* Equivalent to:
71
+
72
+ ``` cpp
73
+ incremented_ = true;
74
+ if constexpr (!forward_range<Base>) {
75
+ if constexpr (Pattern::size() == 0) {
76
+ return *this;
77
+ }
78
+ }
79
+ ++i_.current;
80
+ return *this;
81
+ ```
82
+
83
+ ``` cpp
84
+ friend constexpr bool operator==(const inner-iterator& x, const inner-iterator& y)
85
+ requires forward_range<Base>;
86
+ ```
87
+
88
+ *Effects:* Equivalent to:
89
+ `return x.`*`i_`*`.`*`current`*` == y.`*`i_`*`.`*`current`*`;`
90
+
91
+ ``` cpp
92
+ friend constexpr bool operator==(const inner-iterator& x, default_sentinel_t);
93
+ ```
94
+
95
+ *Effects:* Equivalent to:
96
+
97
+ ``` cpp
98
+ auto [pcur, pend] = subrange{x.i_.parent_->pattern_};
99
+ auto end = ranges::end(x.i_.parent_->base_);
100
+ if constexpr (tiny-range<Pattern>) {
101
+ const auto & cur = x.i_.current;
102
+ if (cur == end) return true;
103
+ if (pcur == pend) return x.incremented_;
104
+ return *cur == *pcur;
105
+ } else {
106
+ auto cur = x.i_.current;
107
+ if (cur == end) return true;
108
+ if (pcur == pend) return x.incremented_;
109
+ do {
110
+ if (*cur != *pcur) return false;
111
+ if (++pcur == pend) return true;
112
+ } while (++cur != end);
113
+ return false;
114
+ }
115
+ ```
116
+
117
+ ``` cpp
118
+ friend constexpr void iter_swap(const inner-iterator& x, const inner-iterator& y)
119
+ noexcept(noexcept(ranges::iter_swap(x.i_.current, y.i_.current)))
120
+ requires indirectly_swappable<iterator_t<Base>>;
121
+ ```
122
+
123
+ *Effects:* Equivalent to
124
+ `ranges::iter_swap(x.`*`i_`*`.`*`current`*`, y.`*`i_`*`.`*`current`*`)`.
125
+