tmp/tmpotw3xoiq/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="re.regiter.general">[[re.regiter.general]]</a>
|
| 2 |
+
|
| 3 |
+
The class template `regex_iterator` is an iterator adaptor. It
|
| 4 |
+
represents a new view of an existing iterator sequence, by enumerating
|
| 5 |
+
all the occurrences of a regular expression within that sequence. A
|
| 6 |
+
`regex_iterator` uses `regex_search` to find successive regular
|
| 7 |
+
expression matches within the sequence from which it was constructed.
|
| 8 |
+
After the iterator is constructed, and every time `operator++` is used,
|
| 9 |
+
the iterator finds and stores a value of
|
| 10 |
+
`match_results<BidirectionalIterator>`. If the end of the sequence is
|
| 11 |
+
reached (`regex_search` returns `false`), the iterator becomes equal to
|
| 12 |
+
the end-of-sequence iterator value. The default constructor constructs
|
| 13 |
+
an end-of-sequence iterator object, which is the only legitimate
|
| 14 |
+
iterator to be used for the end condition. The result of `operator*` on
|
| 15 |
+
an end-of-sequence iterator is not defined. For any other iterator value
|
| 16 |
+
a const `match_results<BidirectionalIterator>&` is returned. The result
|
| 17 |
+
of `operator->` on an end-of-sequence iterator is not defined. For any
|
| 18 |
+
other iterator value a `const match_results<BidirectionalIterator>*` is
|
| 19 |
+
returned. It is impossible to store things into `regex_iterator`s. Two
|
| 20 |
+
end-of-sequence iterators are always equal. An end-of-sequence iterator
|
| 21 |
+
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<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 iterator_concept = input_iterator_tag;
|
| 34 |
+
using value_type = match_results<BidirectionalIterator>;
|
| 35 |
+
using difference_type = ptrdiff_t;
|
| 36 |
+
using pointer = const value_type*;
|
| 37 |
+
using reference = const value_type&;
|
| 38 |
+
|
| 39 |
+
regex_iterator();
|
| 40 |
+
regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
|
| 41 |
+
const regex_type& re,
|
| 42 |
+
regex_constants::match_flag_type m = regex_constants::match_default);
|
| 43 |
+
regex_iterator(BidirectionalIterator, BidirectionalIterator,
|
| 44 |
+
const regex_type&&,
|
| 45 |
+
regex_constants::match_flag_type = regex_constants::match_default) = delete;
|
| 46 |
+
regex_iterator(const regex_iterator&);
|
| 47 |
+
regex_iterator& operator=(const regex_iterator&);
|
| 48 |
+
bool operator==(const regex_iterator&) const;
|
| 49 |
+
bool operator==(default_sentinel_t) const { return *this == regex_iterator(); }
|
| 50 |
+
const value_type& operator*() const;
|
| 51 |
+
const value_type* operator->() const;
|
| 52 |
+
regex_iterator& operator++();
|
| 53 |
+
regex_iterator operator++(int);
|
| 54 |
+
|
| 55 |
+
private:
|
| 56 |
+
BidirectionalIterator begin; // exposition only
|
| 57 |
+
BidirectionalIterator end; // exposition only
|
| 58 |
+
const regex_type* pregex; // exposition only
|
| 59 |
+
regex_constants::match_flag_type flags; // exposition only
|
| 60 |
+
match_results<BidirectionalIterator> match; // exposition only
|
| 61 |
+
};
|
| 62 |
+
}
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
An object of type `regex_iterator` that is not an end-of-sequence
|
| 66 |
+
iterator holds a *zero-length match* if `match[0].matched == true` and
|
| 67 |
+
`match[0].first == match[0].second`.
|
| 68 |
+
|
| 69 |
+
[*Note 1*: For example, this can occur when the part of the regular
|
| 70 |
+
expression that matched consists only of an assertion (such as `'^'`,
|
| 71 |
+
`'$'`, `'\b'`, `'\B'`). — *end note*]
|
| 72 |
+
|