tmp/tmpybzgcxvg/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### General <a id="re.results.general">[[re.results.general]]</a>
|
| 2 |
+
|
| 3 |
+
Class template `match_results` denotes a collection of character
|
| 4 |
+
sequences representing the result of a regular expression match. Storage
|
| 5 |
+
for the collection is allocated and freed as necessary by the member
|
| 6 |
+
functions of class template `match_results`.
|
| 7 |
+
|
| 8 |
+
The class template `match_results` meets the requirements of an
|
| 9 |
+
allocator-aware container and of a sequence container
|
| 10 |
+
[[container.requirements.general]], [[sequence.reqmts]] except that only
|
| 11 |
+
copy assignment, move assignment, and operations defined for
|
| 12 |
+
const-qualified sequence containers are supported and that the semantics
|
| 13 |
+
of the comparison operator functions are different from those required
|
| 14 |
+
for a container.
|
| 15 |
+
|
| 16 |
+
A default-constructed `match_results` object has no fully established
|
| 17 |
+
result state. A match result is *ready* when, as a consequence of a
|
| 18 |
+
completed regular expression match modifying such an object, its result
|
| 19 |
+
state becomes fully established. The effects of calling most member
|
| 20 |
+
functions from a `match_results` object that is not ready are undefined.
|
| 21 |
+
|
| 22 |
+
The `sub_match` object stored at index 0 represents sub-expression 0,
|
| 23 |
+
i.e., the whole match. In this case the `sub_match` member `matched` is
|
| 24 |
+
always `true`. The `sub_match` object stored at index `n` denotes what
|
| 25 |
+
matched the marked sub-expression `n` within the matched expression. If
|
| 26 |
+
the sub-expression `n` participated in a regular expression match then
|
| 27 |
+
the `sub_match` member `matched` evaluates to `true`, and members
|
| 28 |
+
`first` and `second` denote the range of characters \[`first`, `second`)
|
| 29 |
+
which formed that match. Otherwise `matched` is `false`, and members
|
| 30 |
+
`first` and `second` point to the end of the sequence that was searched.
|
| 31 |
+
|
| 32 |
+
[*Note 1*: The `sub_match` objects representing different
|
| 33 |
+
sub-expressions that did not participate in a regular expression match
|
| 34 |
+
need not be distinct. — *end note*]
|
| 35 |
+
|
| 36 |
+
``` cpp
|
| 37 |
+
namespace std {
|
| 38 |
+
template<class BidirectionalIterator,
|
| 39 |
+
class Allocator = allocator<sub_match<BidirectionalIterator>>>
|
| 40 |
+
class match_results {
|
| 41 |
+
public:
|
| 42 |
+
using value_type = sub_match<BidirectionalIterator>;
|
| 43 |
+
using const_reference = const value_type&;
|
| 44 |
+
using reference = value_type&;
|
| 45 |
+
using const_iterator = implementation-defined // type of match_results::const_iterator;
|
| 46 |
+
using iterator = const_iterator;
|
| 47 |
+
using difference_type =
|
| 48 |
+
typename iterator_traits<BidirectionalIterator>::difference_type;
|
| 49 |
+
using size_type = typename allocator_traits<Allocator>::size_type;
|
| 50 |
+
using allocator_type = Allocator;
|
| 51 |
+
using char_type =
|
| 52 |
+
typename iterator_traits<BidirectionalIterator>::value_type;
|
| 53 |
+
using string_type = basic_string<char_type>;
|
| 54 |
+
|
| 55 |
+
// [re.results.const], construct/copy/destroy
|
| 56 |
+
match_results() : match_results(Allocator()) {}
|
| 57 |
+
explicit match_results(const Allocator& a);
|
| 58 |
+
match_results(const match_results& m);
|
| 59 |
+
match_results(const match_results& m, const Allocator& a);
|
| 60 |
+
match_results(match_results&& m) noexcept;
|
| 61 |
+
match_results(match_results&& m, const Allocator& a);
|
| 62 |
+
match_results& operator=(const match_results& m);
|
| 63 |
+
match_results& operator=(match_results&& m);
|
| 64 |
+
~match_results();
|
| 65 |
+
|
| 66 |
+
// [re.results.state], state
|
| 67 |
+
bool ready() const;
|
| 68 |
+
|
| 69 |
+
// [re.results.size], size
|
| 70 |
+
size_type size() const;
|
| 71 |
+
size_type max_size() const;
|
| 72 |
+
[[nodiscard]] bool empty() const;
|
| 73 |
+
|
| 74 |
+
// [re.results.acc], element access
|
| 75 |
+
difference_type length(size_type sub = 0) const;
|
| 76 |
+
difference_type position(size_type sub = 0) const;
|
| 77 |
+
string_type str(size_type sub = 0) const;
|
| 78 |
+
const_reference operator[](size_type n) const;
|
| 79 |
+
|
| 80 |
+
const_reference prefix() const;
|
| 81 |
+
const_reference suffix() const;
|
| 82 |
+
const_iterator begin() const;
|
| 83 |
+
const_iterator end() const;
|
| 84 |
+
const_iterator cbegin() const;
|
| 85 |
+
const_iterator cend() const;
|
| 86 |
+
|
| 87 |
+
// [re.results.form], format
|
| 88 |
+
template<class OutputIter>
|
| 89 |
+
OutputIter
|
| 90 |
+
format(OutputIter out,
|
| 91 |
+
const char_type* fmt_first, const char_type* fmt_last,
|
| 92 |
+
regex_constants::match_flag_type flags = regex_constants::format_default) const;
|
| 93 |
+
template<class OutputIter, class ST, class SA>
|
| 94 |
+
OutputIter
|
| 95 |
+
format(OutputIter out,
|
| 96 |
+
const basic_string<char_type, ST, SA>& fmt,
|
| 97 |
+
regex_constants::match_flag_type flags = regex_constants::format_default) const;
|
| 98 |
+
template<class ST, class SA>
|
| 99 |
+
basic_string<char_type, ST, SA>
|
| 100 |
+
format(const basic_string<char_type, ST, SA>& fmt,
|
| 101 |
+
regex_constants::match_flag_type flags = regex_constants::format_default) const;
|
| 102 |
+
string_type
|
| 103 |
+
format(const char_type* fmt,
|
| 104 |
+
regex_constants::match_flag_type flags = regex_constants::format_default) const;
|
| 105 |
+
|
| 106 |
+
// [re.results.all], allocator
|
| 107 |
+
allocator_type get_allocator() const;
|
| 108 |
+
|
| 109 |
+
// [re.results.swap], swap
|
| 110 |
+
void swap(match_results& that);
|
| 111 |
+
};
|
| 112 |
+
}
|
| 113 |
+
```
|
| 114 |
+
|