From Jason Turner

[re.tokiter]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj0wx76mq/{from.md → to.md} +25 -29
tmp/tmpj0wx76mq/{from.md → to.md} RENAMED
@@ -44,39 +44,38 @@ is not equal to a non-end-of-sequence iterator. Two non-end-of-sequence
44
  iterators are equal when they are constructed from the same arguments.
45
 
46
  ``` cpp
47
  namespace std {
48
  template <class BidirectionalIterator,
49
- class charT = typename iterator_traits<
50
- BidirectionalIterator>::value_type,
51
  class traits = regex_traits<charT>>
52
  class regex_token_iterator {
53
  public:
54
- typedef basic_regex<charT, traits> regex_type;
55
- typedef sub_match<BidirectionalIterator> value_type;
56
- typedef std::ptrdiff_t difference_type;
57
- typedef const value_type* pointer;
58
- typedef const value_type& reference;
59
- typedef std::forward_iterator_tag iterator_category;
60
 
61
  regex_token_iterator();
62
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
63
  const regex_type& re,
64
  int submatch = 0,
65
  regex_constants::match_flag_type m =
66
  regex_constants::match_default);
67
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
68
  const regex_type& re,
69
- const std::vector<int>& submatches,
70
  regex_constants::match_flag_type m =
71
  regex_constants::match_default);
72
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
73
  const regex_type& re,
74
  initializer_list<int> submatches,
75
  regex_constants::match_flag_type m =
76
  regex_constants::match_default);
77
- template <std::size_t N>
78
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
79
  const regex_type& re,
80
  const int (&submatches)[N],
81
  regex_constants::match_flag_type m =
82
  regex_constants::match_default);
@@ -85,19 +84,19 @@ namespace std {
85
  int submatch = 0,
86
  regex_constants::match_flag_type m =
87
  regex_constants::match_default) = delete;
88
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
89
  const regex_type&& re,
90
- const std::vector<int>& submatches,
91
  regex_constants::match_flag_type m =
92
  regex_constants::match_default) = delete;
93
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
94
  const regex_type&& re,
95
  initializer_list<int> submatches,
96
  regex_constants::match_flag_type m =
97
  regex_constants::match_default) = delete;
98
- template <std::size_t N>
99
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
100
  const regex_type&& re,
101
  const int (&submatches)[N],
102
  regex_constants::match_flag_type m =
103
  regex_constants::match_default) = delete;
@@ -107,18 +106,19 @@ namespace std {
107
  bool operator!=(const regex_token_iterator&) const;
108
  const value_type& operator*() const;
109
  const value_type* operator->() const;
110
  regex_token_iterator& operator++();
111
  regex_token_iterator operator++(int);
 
112
  private:
113
- typedef
114
- regex_iterator<BidirectionalIterator, charT, traits> position_iterator; // exposition only
115
  position_iterator position; // exposition only
116
  const value_type* result; // exposition only
117
  value_type suffix; // exposition only
118
- std::size_t N; // exposition only
119
- std::vector<int> subs; // exposition only
120
  };
121
  }
122
  ```
123
 
124
  A *suffix iterator* is a `regex_token_iterator` object that points to a
@@ -126,13 +126,13 @@ final sequence of characters at the end of the target sequence. In a
126
  suffix iterator the member `result` holds a pointer to the data member
127
  `suffix`, the value of the member `suffix.match` is `true`,
128
  `suffix.first` points to the beginning of the final sequence, and
129
  `suffix.second` points to the end of the final sequence.
130
 
131
- For a suffix iterator, data member `suffix.first` is the same as the end
132
- of the last match found, and `suffix.second` is the same as the end of
133
- the target sequence
134
 
135
  The *current match* is `(*position).prefix()` if `subs[N] == -1`, or
136
  `(*position)[subs[N]]` for any other value of `subs[N]`.
137
 
138
  #### `regex_token_iterator` constructors <a id="re.tokiter.cnstr">[[re.tokiter.cnstr]]</a>
@@ -145,31 +145,27 @@ regex_token_iterator();
145
 
146
  ``` cpp
147
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
148
  const regex_type& re,
149
  int submatch = 0,
150
- regex_constants::match_flag_type m =
151
- regex_constants::match_default);
152
 
153
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
154
  const regex_type& re,
155
- const std::vector<int>& submatches,
156
- regex_constants::match_flag_type m =
157
- regex_constants::match_default);
158
 
159
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
160
  const regex_type& re,
161
  initializer_list<int> submatches,
162
- regex_constants::match_flag_type m =
163
- regex_constants::match_default);
164
 
165
- template <std::size_t N>
166
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
167
  const regex_type& re,
168
  const int (&submatches)[N],
169
- regex_constants::match_flag_type m =
170
- regex_constants::match_default);
171
  ```
172
 
173
  *Requires:* Each of the initialization values of `submatches` shall be
174
  `>= -1`.
175
 
 
44
  iterators are equal when they are constructed from the same arguments.
45
 
46
  ``` cpp
47
  namespace std {
48
  template <class BidirectionalIterator,
49
+ class charT = typename iterator_traits<BidirectionalIterator>::value_type,
 
50
  class traits = regex_traits<charT>>
51
  class regex_token_iterator {
52
  public:
53
+ using regex_type = basic_regex<charT, traits>;
54
+ using iterator_category = forward_iterator_tag;
55
+ using value_type = sub_match<BidirectionalIterator>;
56
+ using difference_type = ptrdiff_t;
57
+ using pointer = const value_type*;
58
+ using reference = const value_type&;
59
 
60
  regex_token_iterator();
61
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
62
  const regex_type& re,
63
  int submatch = 0,
64
  regex_constants::match_flag_type m =
65
  regex_constants::match_default);
66
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
67
  const regex_type& re,
68
+ const vector<int>& submatches,
69
  regex_constants::match_flag_type m =
70
  regex_constants::match_default);
71
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
72
  const regex_type& re,
73
  initializer_list<int> submatches,
74
  regex_constants::match_flag_type m =
75
  regex_constants::match_default);
76
+ template <size_t N>
77
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
78
  const regex_type& re,
79
  const int (&submatches)[N],
80
  regex_constants::match_flag_type m =
81
  regex_constants::match_default);
 
84
  int submatch = 0,
85
  regex_constants::match_flag_type m =
86
  regex_constants::match_default) = delete;
87
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
88
  const regex_type&& re,
89
+ const vector<int>& submatches,
90
  regex_constants::match_flag_type m =
91
  regex_constants::match_default) = delete;
92
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
93
  const regex_type&& re,
94
  initializer_list<int> submatches,
95
  regex_constants::match_flag_type m =
96
  regex_constants::match_default) = delete;
97
+ template <size_t N>
98
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
99
  const regex_type&& re,
100
  const int (&submatches)[N],
101
  regex_constants::match_flag_type m =
102
  regex_constants::match_default) = delete;
 
106
  bool operator!=(const regex_token_iterator&) const;
107
  const value_type& operator*() const;
108
  const value_type* operator->() const;
109
  regex_token_iterator& operator++();
110
  regex_token_iterator operator++(int);
111
+
112
  private:
113
+ using position_iterator =
114
+ regex_iterator<BidirectionalIterator, charT, traits>; // exposition only
115
  position_iterator position; // exposition only
116
  const value_type* result; // exposition only
117
  value_type suffix; // exposition only
118
+ size_t N; // exposition only
119
+ vector<int> subs; // exposition only
120
  };
121
  }
122
  ```
123
 
124
  A *suffix iterator* is a `regex_token_iterator` object that points to a
 
126
  suffix iterator the member `result` holds a pointer to the data member
127
  `suffix`, the value of the member `suffix.match` is `true`,
128
  `suffix.first` points to the beginning of the final sequence, and
129
  `suffix.second` points to the end of the final sequence.
130
 
131
+ [*Note 1*: For a suffix iterator, data member `suffix.first` is the
132
+ same as the end of the last match found, and `suffix.second` is the same
133
+ as the end of the target sequence — *end note*]
134
 
135
  The *current match* is `(*position).prefix()` if `subs[N] == -1`, or
136
  `(*position)[subs[N]]` for any other value of `subs[N]`.
137
 
138
  #### `regex_token_iterator` constructors <a id="re.tokiter.cnstr">[[re.tokiter.cnstr]]</a>
 
145
 
146
  ``` cpp
147
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
148
  const regex_type& re,
149
  int submatch = 0,
150
+ regex_constants::match_flag_type m = regex_constants::match_default);
 
151
 
152
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
153
  const regex_type& re,
154
+ const vector<int>& submatches,
155
+ regex_constants::match_flag_type m = regex_constants::match_default);
 
156
 
157
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
158
  const regex_type& re,
159
  initializer_list<int> submatches,
160
+ regex_constants::match_flag_type m = regex_constants::match_default);
 
161
 
162
+ template <size_t N>
163
  regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
164
  const regex_type& re,
165
  const int (&submatches)[N],
166
+ regex_constants::match_flag_type m = regex_constants::match_default);
 
167
  ```
168
 
169
  *Requires:* Each of the initialization values of `submatches` shall be
170
  `>= -1`.
171