tmp/tmpbxn8kjlj/{from.md → to.md}
RENAMED
|
@@ -1,125 +0,0 @@
|
|
| 1 |
-
#### Class template `split_view::outer-iterator` <a id="range.split.outer">[[range.split.outer]]</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>::outer-iterator {
|
| 11 |
-
private:
|
| 12 |
-
using Parent = // exposition only
|
| 13 |
-
conditional_t<Const, const split_view, split_view>;
|
| 14 |
-
using Base = // exposition only
|
| 15 |
-
conditional_t<Const, const V, V>;
|
| 16 |
-
Parent* parent_ = nullptr; // exposition only
|
| 17 |
-
iterator_t<Base> current_ = // exposition only, present only if V models forward_range
|
| 18 |
-
iterator_t<Base>();
|
| 19 |
-
|
| 20 |
-
public:
|
| 21 |
-
using iterator_concept =
|
| 22 |
-
conditional_t<forward_range<Base>, forward_iterator_tag, input_iterator_tag>;
|
| 23 |
-
using iterator_category = input_iterator_tag;
|
| 24 |
-
// [range.split.outer.value], class split_view::outer-iterator::value_type
|
| 25 |
-
struct value_type;
|
| 26 |
-
using difference_type = range_difference_t<Base>;
|
| 27 |
-
|
| 28 |
-
outer-iterator() = default;
|
| 29 |
-
constexpr explicit outer-iterator(Parent& parent)
|
| 30 |
-
requires (!forward_range<Base>);
|
| 31 |
-
constexpr outer-iterator(Parent& parent, iterator_t<Base> current)
|
| 32 |
-
requires forward_range<Base>;
|
| 33 |
-
constexpr outer-iterator(outer-iterator<!Const> i)
|
| 34 |
-
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
|
| 35 |
-
|
| 36 |
-
constexpr value_type operator*() const;
|
| 37 |
-
|
| 38 |
-
constexpr outer-iterator& operator++();
|
| 39 |
-
constexpr decltype(auto) operator++(int) {
|
| 40 |
-
if constexpr (forward_range<Base>) {
|
| 41 |
-
auto tmp = *this;
|
| 42 |
-
++*this;
|
| 43 |
-
return tmp;
|
| 44 |
-
} else
|
| 45 |
-
++*this;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
friend constexpr bool operator==(const outer-iterator& x, const outer-iterator& y)
|
| 49 |
-
requires forward_range<Base>;
|
| 50 |
-
|
| 51 |
-
friend constexpr bool operator==(const outer-iterator& x, default_sentinel_t);
|
| 52 |
-
};
|
| 53 |
-
}
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
Many of the following specifications refer to the notional member
|
| 57 |
-
*current* of *`outer-iterator`*. *current* is equivalent to *`current_`*
|
| 58 |
-
if `V` models `forward_range`, and `parent_->current_` otherwise.
|
| 59 |
-
|
| 60 |
-
``` cpp
|
| 61 |
-
constexpr explicit outer-iterator(Parent& parent)
|
| 62 |
-
requires (!forward_range<Base>);
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
-
*Effects:* Initializes *parent\_* with `addressof(parent)`.
|
| 66 |
-
|
| 67 |
-
``` cpp
|
| 68 |
-
constexpr outer-iterator(Parent& parent, iterator_t<Base> current)
|
| 69 |
-
requires forward_range<Base>;
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
*Effects:* Initializes *parent\_* with `addressof(parent)` and
|
| 73 |
-
*current\_* with `std::move(current)`.
|
| 74 |
-
|
| 75 |
-
``` cpp
|
| 76 |
-
constexpr outer-iterator(outer-iterator<!Const> i)
|
| 77 |
-
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
-
*Effects:* Initializes *parent\_* with `i.`*`parent_`* and *current\_*
|
| 81 |
-
with `std::move(i.`*`current_`*`)`.
|
| 82 |
-
|
| 83 |
-
``` cpp
|
| 84 |
-
constexpr value_type operator*() const;
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
*Effects:* Equivalent to: `return value_type{*this};`
|
| 88 |
-
|
| 89 |
-
``` cpp
|
| 90 |
-
constexpr outer-iterator& operator++();
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
*Effects:* Equivalent to:
|
| 94 |
-
|
| 95 |
-
``` cpp
|
| 96 |
-
const auto end = ranges::end(parent_->base_);
|
| 97 |
-
if (current == end) return *this;
|
| 98 |
-
const auto [pbegin, pend] = subrange{parent_->pattern_};
|
| 99 |
-
if (pbegin == pend) ++current;
|
| 100 |
-
else {
|
| 101 |
-
do {
|
| 102 |
-
auto [b, p] = ranges::mismatch(std::move(current), end, pbegin, pend);
|
| 103 |
-
current = std::move(b);
|
| 104 |
-
if (p == pend) {
|
| 105 |
-
break; // The pattern matched; skip it
|
| 106 |
-
}
|
| 107 |
-
} while (++current != end);
|
| 108 |
-
}
|
| 109 |
-
return *this;
|
| 110 |
-
```
|
| 111 |
-
|
| 112 |
-
``` cpp
|
| 113 |
-
friend constexpr bool operator==(const outer-iterator& x, const outer-iterator& y)
|
| 114 |
-
requires forward_range<Base>;
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
*Effects:* Equivalent to: `return x.`*`current_`*` == y.`*`current_`*`;`
|
| 118 |
-
|
| 119 |
-
``` cpp
|
| 120 |
-
friend constexpr bool operator==(const outer-iterator& x, default_sentinel_t);
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
*Effects:* Equivalent to:
|
| 124 |
-
`return x.`*`current`*` == ranges::end(x.`*`parent_`*`->`*`base_`*`);`
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|