tmp/tmpw8d6j6zp/{from.md → to.md}
RENAMED
|
@@ -22,39 +22,37 @@ is not equal to a non-end-of-sequence iterator. Two non-end-of-sequence
|
|
| 22 |
iterators are equal when they are constructed from the same arguments.
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
namespace std {
|
| 26 |
template <class BidirectionalIterator,
|
| 27 |
-
class charT = typename iterator_traits<
|
| 28 |
-
BidirectionalIterator>::value_type,
|
| 29 |
class traits = regex_traits<charT>>
|
| 30 |
class regex_iterator {
|
| 31 |
public:
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
regex_iterator();
|
| 40 |
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
| 41 |
const regex_type& re,
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
regex_constants::match_flag_type m =
|
| 47 |
-
regex_constants::match_default) = delete;
|
| 48 |
regex_iterator(const regex_iterator&);
|
| 49 |
regex_iterator& operator=(const regex_iterator&);
|
| 50 |
bool operator==(const regex_iterator&) const;
|
| 51 |
bool operator!=(const regex_iterator&) const;
|
| 52 |
const value_type& operator*() const;
|
| 53 |
const value_type* operator->() const;
|
| 54 |
regex_iterator& operator++();
|
| 55 |
regex_iterator operator++(int);
|
|
|
|
| 56 |
private:
|
| 57 |
BidirectionalIterator begin; // exposition only
|
| 58 |
BidirectionalIterator end; // exposition only
|
| 59 |
const regex_type* pregex; // exposition only
|
| 60 |
regex_constants::match_flag_type flags; // exposition only
|
|
@@ -63,13 +61,15 @@ namespace std {
|
|
| 63 |
}
|
| 64 |
```
|
| 65 |
|
| 66 |
An object of type `regex_iterator` that is not an end-of-sequence
|
| 67 |
iterator holds a *zero-length match* if `match[0].matched == true` and
|
| 68 |
-
`match[0].first == match[0].second`.
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
#### `regex_iterator` constructors <a id="re.regiter.cnstr">[[re.regiter.cnstr]]</a>
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
regex_iterator();
|
|
@@ -137,43 +137,50 @@ regex_iterator& operator++();
|
|
| 137 |
|
| 138 |
If the iterator holds a zero-length match and `start == end` the
|
| 139 |
operator sets `*this` to the end-of-sequence iterator and returns
|
| 140 |
`*this`.
|
| 141 |
|
| 142 |
-
Otherwise, if the iterator holds a zero-length match the operator
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
If the most recent match was not a zero-length match, the operator sets
|
| 149 |
-
`flags` to `flags
|
| 150 |
`regex_search(start, end, match, *pregex, flags)`. If the call returns
|
| 151 |
`false` the iterator sets `*this` to the end-of-sequence iterator. The
|
| 152 |
iterator then returns `*this`.
|
| 153 |
|
| 154 |
In all cases in which the call to `regex_search` returns `true`,
|
| 155 |
`match.prefix().first` shall be equal to the previous value of
|
| 156 |
`match[0].second`, and for each index `i` in the half-open range
|
| 157 |
-
`[0, match.size())` for which `match[i].matched` is true,
|
| 158 |
-
`match
|
| 159 |
|
| 160 |
-
This means that `match
|
| 161 |
-
beginning of the target sequence, which is often not the same as the
|
| 162 |
-
offset from the sequence passed in the call to
|
|
|
|
| 163 |
|
| 164 |
It is unspecified how the implementation makes these adjustments.
|
| 165 |
|
| 166 |
-
This means that a compiler may call an
|
| 167 |
-
function, in which case a user-defined
|
| 168 |
-
will not be called.
|
| 169 |
|
| 170 |
``` cpp
|
| 171 |
regex_iterator operator++(int);
|
| 172 |
```
|
| 173 |
|
| 174 |
-
*Effects:*
|
| 175 |
|
| 176 |
``` cpp
|
| 177 |
regex_iterator tmp = *this;
|
| 178 |
++(*this);
|
| 179 |
return tmp;
|
|
|
|
| 22 |
iterators are equal when they are constructed from the same arguments.
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
namespace std {
|
| 26 |
template <class BidirectionalIterator,
|
| 27 |
+
class charT = typename iterator_traits<BidirectionalIterator>::value_type,
|
|
|
|
| 28 |
class traits = regex_traits<charT>>
|
| 29 |
class regex_iterator {
|
| 30 |
public:
|
| 31 |
+
using regex_type = basic_regex<charT, traits>;
|
| 32 |
+
using iterator_category = forward_iterator_tag;
|
| 33 |
+
using value_type = match_results<BidirectionalIterator>;
|
| 34 |
+
using difference_type = ptrdiff_t;
|
| 35 |
+
using pointer = const value_type*;
|
| 36 |
+
using reference = const value_type&;
|
| 37 |
|
| 38 |
regex_iterator();
|
| 39 |
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
| 40 |
const regex_type& re,
|
| 41 |
+
regex_constants::match_flag_type m = regex_constants::match_default);
|
| 42 |
+
regex_iterator(BidirectionalIterator, BidirectionalIterator,
|
| 43 |
+
const regex_type&&,
|
| 44 |
+
regex_constants::match_flag_type = regex_constants::match_default) = delete;
|
|
|
|
|
|
|
| 45 |
regex_iterator(const regex_iterator&);
|
| 46 |
regex_iterator& operator=(const regex_iterator&);
|
| 47 |
bool operator==(const regex_iterator&) const;
|
| 48 |
bool operator!=(const regex_iterator&) const;
|
| 49 |
const value_type& operator*() const;
|
| 50 |
const value_type* operator->() const;
|
| 51 |
regex_iterator& operator++();
|
| 52 |
regex_iterator operator++(int);
|
| 53 |
+
|
| 54 |
private:
|
| 55 |
BidirectionalIterator begin; // exposition only
|
| 56 |
BidirectionalIterator end; // exposition only
|
| 57 |
const regex_type* pregex; // exposition only
|
| 58 |
regex_constants::match_flag_type flags; // exposition only
|
|
|
|
| 61 |
}
|
| 62 |
```
|
| 63 |
|
| 64 |
An object of type `regex_iterator` that is not an end-of-sequence
|
| 65 |
iterator holds a *zero-length match* if `match[0].matched == true` and
|
| 66 |
+
`match[0].first == match[0].second`.
|
| 67 |
+
|
| 68 |
+
[*Note 1*: For example, this can occur when the part of the regular
|
| 69 |
+
expression that matched consists only of an assertion (such as `'^'`,
|
| 70 |
+
`'$'`, `'\b'`, `'\B'`). — *end note*]
|
| 71 |
|
| 72 |
#### `regex_iterator` constructors <a id="re.regiter.cnstr">[[re.regiter.cnstr]]</a>
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
regex_iterator();
|
|
|
|
| 137 |
|
| 138 |
If the iterator holds a zero-length match and `start == end` the
|
| 139 |
operator sets `*this` to the end-of-sequence iterator and returns
|
| 140 |
`*this`.
|
| 141 |
|
| 142 |
+
Otherwise, if the iterator holds a zero-length match, the operator
|
| 143 |
+
calls:
|
| 144 |
+
|
| 145 |
+
``` cpp
|
| 146 |
+
regex_search(start, end, match, *pregex,
|
| 147 |
+
flags | regex_constants::match_not_null | regex_constants::match_continuous)
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
If the call returns `true` the operator returns `*this`. Otherwise the
|
| 151 |
+
operator increments `start` and continues as if the most recent match
|
| 152 |
+
was not a zero-length match.
|
| 153 |
|
| 154 |
If the most recent match was not a zero-length match, the operator sets
|
| 155 |
+
`flags` to `flags | regex_constants::match_prev_avail` and calls
|
| 156 |
`regex_search(start, end, match, *pregex, flags)`. If the call returns
|
| 157 |
`false` the iterator sets `*this` to the end-of-sequence iterator. The
|
| 158 |
iterator then returns `*this`.
|
| 159 |
|
| 160 |
In all cases in which the call to `regex_search` returns `true`,
|
| 161 |
`match.prefix().first` shall be equal to the previous value of
|
| 162 |
`match[0].second`, and for each index `i` in the half-open range
|
| 163 |
+
`[0, match.size())` for which `match[i].matched` is `true`,
|
| 164 |
+
`match.position(i)` shall return `distance(begin, match[i].first)`.
|
| 165 |
|
| 166 |
+
[*Note 1*: This means that `match.position(i)` gives the offset from
|
| 167 |
+
the beginning of the target sequence, which is often not the same as the
|
| 168 |
+
offset from the sequence passed in the call to
|
| 169 |
+
`regex_search`. — *end note*]
|
| 170 |
|
| 171 |
It is unspecified how the implementation makes these adjustments.
|
| 172 |
|
| 173 |
+
[*Note 2*: This means that a compiler may call an
|
| 174 |
+
implementation-specific search function, in which case a user-defined
|
| 175 |
+
specialization of `regex_search` will not be called. — *end note*]
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
regex_iterator operator++(int);
|
| 179 |
```
|
| 180 |
|
| 181 |
+
*Effects:* As if by:
|
| 182 |
|
| 183 |
``` cpp
|
| 184 |
regex_iterator tmp = *this;
|
| 185 |
++(*this);
|
| 186 |
return tmp;
|