From Jason Turner

[range.split.iterator]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6l7gdxgn/{from.md → to.md} +97 -0
tmp/tmp6l7gdxgn/{from.md → to.md} RENAMED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Class `split_view::iterator` <a id="range.split.iterator">[[range.split.iterator]]</a>
2
+
3
+ ``` cpp
4
+ namespace std::ranges {
5
+ template<forward_range V, forward_range Pattern>
6
+ requires view<V> && view<Pattern> &&
7
+ indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
8
+ class split_view<V, Pattern>::iterator {
9
+ private:
10
+ split_view* parent_ = nullptr; // exposition only
11
+ iterator_t<V> cur_ = iterator_t<V>(); // exposition only
12
+ subrange<iterator_t<V>> next_ = subrange<iterator_t<V>>(); // exposition only
13
+ bool trailing_empty_ = false; // exposition only
14
+
15
+ public:
16
+ using iterator_concept = forward_iterator_tag;
17
+ using iterator_category = input_iterator_tag;
18
+ using value_type = subrange<iterator_t<V>>;
19
+ using difference_type = range_difference_t<V>;
20
+
21
+ iterator() = default;
22
+ constexpr iterator(split_view& parent, iterator_t<V> current, subrange<iterator_t<V>> next);
23
+
24
+ constexpr iterator_t<V> base() const;
25
+ constexpr value_type operator*() const;
26
+
27
+ constexpr iterator& operator++();
28
+ constexpr iterator operator++(int);
29
+
30
+ friend constexpr bool operator==(const iterator& x, const iterator& y);
31
+ };
32
+ }
33
+ ```
34
+
35
+ ``` cpp
36
+ constexpr iterator(split_view& parent, iterator_t<V> current, subrange<iterator_t<V>> next);
37
+ ```
38
+
39
+ *Effects:* Initializes *parent\_* with `addressof(parent)`, *cur\_* with
40
+ `std::move(current)`, and *next\_* with `std::move(next)`.
41
+
42
+ ``` cpp
43
+ constexpr iterator_t<V> base() const;
44
+ ```
45
+
46
+ *Effects:* Equivalent to `return `*`cur_`*`;`
47
+
48
+ ``` cpp
49
+ constexpr value_type operator*() const;
50
+ ```
51
+
52
+ *Effects:* Equivalent to `return {`*`cur_`*`, `*`next_`*`.begin()};`
53
+
54
+ ``` cpp
55
+ constexpr iterator& operator++();
56
+ ```
57
+
58
+ *Effects:* Equivalent to:
59
+
60
+ ``` cpp
61
+ cur_ = next_.begin();
62
+ if (cur_ != ranges::end(parent_->base_)) {
63
+ cur_ = next_.end();
64
+ if (cur_ == ranges::end(parent_->base_)) {
65
+ trailing_empty_ = true;
66
+ next_ = {cur_, cur_};
67
+ } else {
68
+ next_ = parent_->find-next(cur_);
69
+ }
70
+ } else {
71
+ trailing_empty_ = false;
72
+ }
73
+ return *this;
74
+ ```
75
+
76
+ ``` cpp
77
+ constexpr iterator operator++(int);
78
+ ```
79
+
80
+ *Effects:* Equivalent to:
81
+
82
+ ``` cpp
83
+ auto tmp = *this;
84
+ ++*this;
85
+ return tmp;
86
+ ```
87
+
88
+ ``` cpp
89
+ friend constexpr bool operator==(const iterator& x, const iterator& y);
90
+ ```
91
+
92
+ *Effects:* Equivalent to:
93
+
94
+ ``` cpp
95
+ return x.cur_ == y.cur_ && x.trailing_empty_ == y.trailing_empty_;
96
+ ```
97
+