tmp/tmp5jiaadry/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class `chunk_by_view::iterator` <a id="range.chunk.by.iter">[[range.chunk.by.iter]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
|
| 6 |
+
requires view<V> && is_object_v<Pred>
|
| 7 |
+
class chunk_by_view<V, Pred>::iterator {
|
| 8 |
+
chunk_by_view* parent_ = nullptr; // exposition only
|
| 9 |
+
iterator_t<V> current_ = iterator_t<V>(); // exposition only
|
| 10 |
+
iterator_t<V> next_ = iterator_t<V>(); // exposition only
|
| 11 |
+
|
| 12 |
+
constexpr iterator(chunk_by_view& parent, iterator_t<V> current, // exposition only
|
| 13 |
+
iterator_t<V> next);
|
| 14 |
+
|
| 15 |
+
public:
|
| 16 |
+
using value_type = subrange<iterator_t<V>>;
|
| 17 |
+
using difference_type = range_difference_t<V>;
|
| 18 |
+
using iterator_category = input_iterator_tag;
|
| 19 |
+
using iterator_concept = see below;
|
| 20 |
+
|
| 21 |
+
iterator() = default;
|
| 22 |
+
|
| 23 |
+
constexpr value_type operator*() const;
|
| 24 |
+
constexpr iterator& operator++();
|
| 25 |
+
constexpr iterator operator++(int);
|
| 26 |
+
|
| 27 |
+
constexpr iterator& operator--() requires bidirectional_range<V>;
|
| 28 |
+
constexpr iterator operator--(int) requires bidirectional_range<V>;
|
| 29 |
+
|
| 30 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y);
|
| 31 |
+
friend constexpr bool operator==(const iterator& x, default_sentinel_t);
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
`iterator::iterator_concept` is defined as follows:
|
| 37 |
+
|
| 38 |
+
- If `V` models `bidirectional_range`, then `iterator_concept` denotes
|
| 39 |
+
`bidirectional_iterator_tag`.
|
| 40 |
+
- Otherwise, `iterator_concept` denotes `forward_iterator_tag`.
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
constexpr iterator(chunk_by_view& parent, iterator_t<V> current, iterator_t<V> next);
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
*Effects:* Initializes *parent\_* with `addressof(parent)`, *current\_*
|
| 47 |
+
with `current`, and *next\_* with `next`.
|
| 48 |
+
|
| 49 |
+
``` cpp
|
| 50 |
+
constexpr value_type operator*() const;
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
*Preconditions:* *current\_* is not equal to *next\_*.
|
| 54 |
+
|
| 55 |
+
*Returns:* `subrange(`*`current_`*`, `*`next_`*`)`.
|
| 56 |
+
|
| 57 |
+
``` cpp
|
| 58 |
+
constexpr iterator& operator++();
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
*Preconditions:* *current\_* is not equal to *next\_*.
|
| 62 |
+
|
| 63 |
+
*Effects:* Equivalent to:
|
| 64 |
+
|
| 65 |
+
``` cpp
|
| 66 |
+
current_ = next_;
|
| 67 |
+
next_ = parent_->find-next(current_);
|
| 68 |
+
return *this;
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
``` cpp
|
| 72 |
+
constexpr iterator operator++(int);
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
*Effects:* Equivalent to:
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
auto tmp = *this;
|
| 79 |
+
++*this;
|
| 80 |
+
return tmp;
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
``` cpp
|
| 84 |
+
constexpr iterator& operator--() requires bidirectional_range<V>;
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
*Effects:* Equivalent to:
|
| 88 |
+
|
| 89 |
+
``` cpp
|
| 90 |
+
next_ = current_;
|
| 91 |
+
current_ = parent_->find-prev(next_);
|
| 92 |
+
return *this;
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
``` cpp
|
| 96 |
+
constexpr iterator operator--(int) requires bidirectional_range<V>;
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
*Effects:* Equivalent to:
|
| 100 |
+
|
| 101 |
+
``` cpp
|
| 102 |
+
auto tmp = *this;
|
| 103 |
+
--*this;
|
| 104 |
+
return tmp;
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
``` cpp
|
| 108 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y);
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
*Returns:* `x.`*`current_`*` == y.`*`current_`*.
|
| 112 |
+
|
| 113 |
+
``` cpp
|
| 114 |
+
friend constexpr bool operator==(const iterator& x, default_sentinel_t);
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
*Returns:* `x.`*`current_`*` == x.`*`next_`*.
|
| 118 |
+
|