2 Copyright 2006-2007 John Maddock.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt).
9 [section:sub_match sub_match]
11 #include <boost/regex.hpp>
13 Regular expressions are different from many simple pattern-matching algorithms in
14 that as well as finding an overall match they can also produce sub-expression
15 matches: each sub-expression being delimited in the pattern by a pair of
16 parenthesis (...). There has to be some method for reporting sub-expression
17 matches back to the user: this is achieved this by defining a class
18 [match_results] that acts as an indexed collection of sub-expression matches,
19 each sub-expression match being contained in an object of type [sub_match].
21 Objects of type [sub_match] may only be obtained by subscripting an object of
24 Objects of type [sub_match] may be compared to objects of type `std::basic_string`,
25 or `const charT*` or `const charT`.
27 Objects of type [sub_match] may be added to objects of type `std::basic_string`, or
28 `const charT*` or `const charT`, to produce a new `std::basic_string` object.
30 When the marked sub-expression denoted by an object of type [sub_match]
31 participated in a regular expression match then member /matched/ evaluates
32 to /true/, and members /first/ and /second/ denote the range of characters
33 \[first,second) which formed that match. Otherwise /matched/ is /false/, and
34 members /first/ and /second/ contained undefined values.
36 When the marked sub-expression denoted by an object of type
37 [sub_match] was repeated, then the [sub_match] object represents
38 the match obtained by the /last/ repeat. The complete set of all the
39 captures obtained for all the repeats, may be accessed via the
40 captures() member function (Note: this has serious performance implications,
41 you have to explicitly enable this feature).
43 If an object of type [sub_match] represents sub-expression 0 - that is to
44 say the whole match - then member /matched/ is always /true/, unless a
45 [link boost_regex.partial_matches partial match] was obtained as a result of the flag
46 `match_partial` being passed to a regular expression algorithm, in which
47 case member /matched/ is /false/, and members /first/ and /second/ represent
48 the character range that formed the partial match.
52 template <class BidirectionalIterator>
55 typedef sub_match<const char*> csub_match;
56 typedef sub_match<const wchar_t*> wcsub_match;
57 typedef sub_match<std::string::const_iterator> ssub_match;
58 typedef sub_match<std::wstring::const_iterator> wssub_match;
60 template <class BidirectionalIterator>
61 class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator>
64 typedef typename iterator_traits<BidirectionalIterator>::value_type ``[link boost_regex.sub_match.value_type value_type]``;
65 typedef typename iterator_traits<BidirectionalIterator>::difference_type ``[link boost_regex.sub_match.diff_type difference_type]``;
66 typedef BidirectionalIterator ``[link boost_regex.sub_match.it_type iterator]``;
68 bool ``[link boost_regex.sub_match.matched matched]``;
70 difference_type ``[link boost_regex.sub_match.length length]``()const;
71 ``[link boost_regex.sub_match.cast operator basic_string<value_type>]``()const;
72 basic_string<value_type> ``[link boost_regex.sub_match.str str]``()const;
74 int ``[link boost_regex.sub_match.compare1 compare]``(const sub_match& s)const;
75 int ``[link boost_regex.sub_match.compare2 compare]``(const basic_string<value_type>& s)const;
76 int ``[link boost_regex.sub_match.compare3 compare]``(const value_type* s)const;
77 #ifdef BOOST_REGEX_MATCH_EXTRA
78 typedef implementation-private ``[link boost_regex.sub_match.cap_seq_type capture_sequence_type]``;
79 const capture_sequence_type& ``[link boost_regex.sub_match.captures captures]``()const;
83 // comparisons to another sub_match:
85 template <class BidirectionalIterator>
86 bool ``[link boost_regex.sub_match.op_compare1 operator ==]`` (const sub_match<BidirectionalIterator>& lhs,
87 const sub_match<BidirectionalIterator>& rhs);
88 template <class BidirectionalIterator>
89 bool ``[link boost_regex.sub_match.op_compare2 operator !=]`` (const sub_match<BidirectionalIterator>& lhs,
90 const sub_match<BidirectionalIterator>& rhs);
91 template <class BidirectionalIterator>
92 bool ``[link boost_regex.sub_match.op_compare3 operator <]`` (const sub_match<BidirectionalIterator>& lhs,
93 const sub_match<BidirectionalIterator>& rhs);
94 template <class BidirectionalIterator>
95 bool ``[link boost_regex.sub_match.op_compare4 operator <=]`` (const sub_match<BidirectionalIterator>& lhs,
96 const sub_match<BidirectionalIterator>& rhs);
97 template <class BidirectionalIterator>
98 bool ``[link boost_regex.sub_match.op_compare5 operator >=]`` (const sub_match<BidirectionalIterator>& lhs,
99 const sub_match<BidirectionalIterator>& rhs);
100 template <class BidirectionalIterator>
101 bool ``[link boost_regex.sub_match.op_compare6 operator >]`` (const sub_match<BidirectionalIterator>& lhs,
102 const sub_match<BidirectionalIterator>& rhs);
106 // comparisons to a basic_string:
108 template <class BidirectionalIterator, class traits, class Allocator>
109 bool ``[link boost_regex.sub_match.op_compare7 operator ==]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
112 const sub_match<BidirectionalIterator>& rhs);
113 template <class BidirectionalIterator, class traits, class Allocator>
114 bool ``[link boost_regex.sub_match.op_compare8 operator != ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
117 const sub_match<BidirectionalIterator>& rhs);
118 template <class BidirectionalIterator, class traits, class Allocator>
119 bool ``[link boost_regex.sub_match.op_compare9 operator <]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
122 const sub_match<BidirectionalIterator>& rhs);
123 template <class BidirectionalIterator, class traits, class Allocator>
124 bool ``[link boost_regex.sub_match.op_compare10 operator >]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
127 const sub_match<BidirectionalIterator>& rhs);
128 template <class BidirectionalIterator, class traits, class Allocator>
129 bool ``[link boost_regex.sub_match.op_compare11 operator >= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
132 const sub_match<BidirectionalIterator>& rhs);
133 template <class BidirectionalIterator, class traits, class Allocator>
134 bool ``[link boost_regex.sub_match.op_compare12 operator <= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
137 const sub_match<BidirectionalIterator>& rhs);
139 template <class BidirectionalIterator, class traits, class Allocator>
140 bool ``[link boost_regex.sub_match.op_compare13 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
141 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
144 template <class BidirectionalIterator, class traits, class Allocator>
145 bool ``[link boost_regex.sub_match.op_compare14 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
146 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
149 template <class BidirectionalIterator, class traits, class Allocator>
150 bool ``[link boost_regex.sub_match.op_compare15 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
151 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
154 template <class BidirectionalIterator, class traits, class Allocator>
155 bool ``[link boost_regex.sub_match.op_compare16 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
156 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
159 template <class BidirectionalIterator, class traits, class Allocator>
160 bool ``[link boost_regex.sub_match.op_compare17 operator >= ]``(const sub_match<BidirectionalIterator>& lhs,
161 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
164 template <class BidirectionalIterator, class traits, class Allocator>
165 bool ``[link boost_regex.sub_match.op_compare18 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
166 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
171 // comparisons to a pointer to a character array:
173 template <class BidirectionalIterator>
174 bool ``[link boost_regex.sub_match.op_compare19 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
175 const sub_match<BidirectionalIterator>& rhs);
176 template <class BidirectionalIterator>
177 bool ``[link boost_regex.sub_match.op_compare20 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
178 const sub_match<BidirectionalIterator>& rhs);
179 template <class BidirectionalIterator>
180 bool ``[link boost_regex.sub_match.op_compare21 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
181 const sub_match<BidirectionalIterator>& rhs);
182 template <class BidirectionalIterator>
183 bool ``[link boost_regex.sub_match.op_compare22 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
184 const sub_match<BidirectionalIterator>& rhs);
185 template <class BidirectionalIterator>
186 bool ``[link boost_regex.sub_match.op_compare23 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
187 const sub_match<BidirectionalIterator>& rhs);
188 template <class BidirectionalIterator>
189 bool ``[link boost_regex.sub_match.op_compare24 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
190 const sub_match<BidirectionalIterator>& rhs);
192 template <class BidirectionalIterator>
193 bool ``[link boost_regex.sub_match.op_compare25 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
194 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
195 template <class BidirectionalIterator>
196 bool ``[link boost_regex.sub_match.op_compare26 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
197 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
198 template <class BidirectionalIterator>
199 bool ``[link boost_regex.sub_match.op_compare27 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
200 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
201 template <class BidirectionalIterator>
202 bool ``[link boost_regex.sub_match.op_compare28 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
203 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
204 template <class BidirectionalIterator>
205 bool ``[link boost_regex.sub_match.op_compare29 operator >= ]``(const sub_match<BidirectionalIterator>& lhs,
206 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
207 template <class BidirectionalIterator>
208 bool ``[link boost_regex.sub_match.op_compare30 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
209 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
212 // comparisons to a single character:
214 template <class BidirectionalIterator>
215 bool ``[link boost_regex.sub_match.op_compare31 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
216 const sub_match<BidirectionalIterator>& rhs);
217 template <class BidirectionalIterator>
218 bool ``[link boost_regex.sub_match.op_compare32 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
219 const sub_match<BidirectionalIterator>& rhs);
220 template <class BidirectionalIterator>
221 bool ``[link boost_regex.sub_match.op_compare33 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
222 const sub_match<BidirectionalIterator>& rhs);
223 template <class BidirectionalIterator>
224 bool ``[link boost_regex.sub_match.op_compare34 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
225 const sub_match<BidirectionalIterator>& rhs);
226 template <class BidirectionalIterator>
227 bool ``[link boost_regex.sub_match.op_compare35 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
228 const sub_match<BidirectionalIterator>& rhs);
229 template <class BidirectionalIterator>
230 bool ``[link boost_regex.sub_match.op_compare36 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
231 const sub_match<BidirectionalIterator>& rhs);
233 template <class BidirectionalIterator>
234 bool ``[link boost_regex.sub_match.op_compare37 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
235 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
236 template <class BidirectionalIterator>
237 bool ``[link boost_regex.sub_match.op_compare38 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
238 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
239 template <class BidirectionalIterator>
240 bool ``[link boost_regex.sub_match.op_compare39 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
241 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
242 template <class BidirectionalIterator>
243 bool ``[link boost_regex.sub_match.op_compare40 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
244 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
245 template <class BidirectionalIterator>
246 bool ``[link boost_regex.sub_match.op_compare41 operator >= ]``(const sub_match<BidirectionalIterator>& lhs,
247 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
248 template <class BidirectionalIterator>
249 bool ``[link boost_regex.sub_match.op_compare42 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
250 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
252 // addition operators:
254 template <class BidirectionalIterator, class traits, class Allocator>
255 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
256 ``[link boost_regex.sub_match.op_add1 operator + ]``(const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
259 const sub_match<BidirectionalIterator>& m);
260 template <class BidirectionalIterator, class traits, class Allocator>
261 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
262 ``[link boost_regex.sub_match.op_add2 operator + ]``(const sub_match<BidirectionalIterator>& m,
263 const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
266 template <class BidirectionalIterator>
267 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
268 ``[link boost_regex.sub_match.op_add3 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const* s,
269 const sub_match<BidirectionalIterator>& m);
270 template <class BidirectionalIterator>
271 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
272 ``[link boost_regex.sub_match.op_add4 operator + ]``(const sub_match<BidirectionalIterator>& m,
273 typename iterator_traits<BidirectionalIterator>::value_type const * s);
274 template <class BidirectionalIterator>
275 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
276 ``[link boost_regex.sub_match.op_add5 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const& s,
277 const sub_match<BidirectionalIterator>& m);
278 template <class BidirectionalIterator>
279 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
280 ``[link boost_regex.sub_match.op_add6 operator + ]``(const sub_match<BidirectionalIterator>& m,
281 typename iterator_traits<BidirectionalIterator>::value_type const& s);
282 template <class BidirectionalIterator>
283 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
284 ``[link boost_regex.sub_match.op_add7 operator + ]``(const sub_match<BidirectionalIterator>& m1,
285 const sub_match<BidirectionalIterator>& m2);
290 template <class charT, class traits, class BidirectionalIterator>
291 basic_ostream<charT, traits>&
292 ``[link boost_regex.sub_match.op_stream operator << ]``(basic_ostream<charT, traits>& os,
293 const sub_match<BidirectionalIterator>& m);
301 [#boost_regex.sub_match.value_type]
303 typedef typename std::iterator_traits<iterator>::value_type value_type;
305 The type pointed to by the iterators.
307 [#boost_regex.sub_match.diff_type]
309 typedef typename std::iterator_traits<iterator>::difference_type difference_type;
311 A type that represents the difference between two iterators.
313 [#boost_regex.sub_match.it_type]
315 typedef BidirectionalIterator iterator;
319 [#boost_regex.sub_match.first]
323 An iterator denoting the position of the start of the match.
325 [#boost_regex.sub_match.second]
329 An iterator denoting the position of the end of the match.
331 [#boost_regex.sub_match.matched]
335 A Boolean value denoting whether this sub-expression participated in the match.
337 [#boost_regex.sub_match.length]
339 static difference_type length();
341 [*Effects]: returns the length of this matched sub-expression, or 0
342 if this sub-expression was not matched: `matched ? distance(first, second) : 0)`.
344 [#boost_regex.sub_match.cast]
346 operator basic_string<value_type>()const;
348 [*Effects]: converts `*this` into a string: returns
349 `(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`.
351 [#boost_regex.sub_match.str]
353 basic_string<value_type> str()const;
355 [*Effects]: returns a string representation of `*this`:
356 `(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`.
358 [#boost_regex.sub_match.compare1]
360 int compare(const sub_match& s)const;
362 [*Effects]: performs a lexical comparison to /s/: returns `str().compare(s.str())`.
364 [#boost_regex.sub_match.compare2]
366 int compare(const basic_string<value_type>& s)const;
368 [*Effects]: compares `*this` to the string /s/: returns `str().compare(s)`.
370 [#boost_regex.sub_match.compare3]
372 int compare(const value_type* s)const;
374 [*Effects]: compares `*this` to the null-terminated string /s/: returns `str().compare(s)`.
376 [#boost_regex.sub_match.cap_seq_type]
378 typedef implementation-private capture_sequence_type;
380 Defines an implementation-specific type that satisfies the requirements of
381 a standard library Sequence (21.1.1 including the optional Table 68 operations),
382 whose value_type is a `sub_match<BidirectionalIterator>`. This type
383 happens to be `std::vector<sub_match<BidirectionalIterator> >`, but you
384 shouldn't actually rely on that.
386 [#boost_regex.sub_match.captures]
388 const capture_sequence_type& captures()const;
390 [*Effects]: returns a sequence containing all the captures obtained for this
393 [*Preconditions]: the library must be built and used with
394 BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag `match_extra`
395 to the regex matching functions ([regex_match], [regex_search],
396 [regex_iterator] or [regex_token_iterator]) in order for this member
397 #function to be defined and return useful information.
399 [*Rationale]: Enabling this feature has several consequences:
401 * sub_match occupies more memory resulting in complex expressions running out of memory or stack space more quickly during matching.
402 * The matching algorithms are less efficient at handling some features (independent sub-expressions for example), even when match_extra is not used.
403 * The matching algorithms are much less efficient (i.e. slower), when match_extra is used. Mostly this is down to the extra memory allocations that have to take place.
405 [h5 sub_match non-member operators]
407 [#boost_regex.sub_match.op_compare1]
409 template <class BidirectionalIterator>
410 bool operator == (const sub_match<BidirectionalIterator>& lhs,
411 const sub_match<BidirectionalIterator>& rhs);
413 [*Effects]: returns `lhs.compare(rhs) == 0`.
415 [#boost_regex.sub_match.op_compare2]
417 template <class BidirectionalIterator>
418 bool operator != (const sub_match<BidirectionalIterator>& lhs,
419 const sub_match<BidirectionalIterator>& rhs);
421 [*Effects]: returns `lhs.compare(rhs) != 0`.
423 [#boost_regex.sub_match.op_compare3]
425 template <class BidirectionalIterator>
426 bool operator < (const sub_match<BidirectionalIterator>& lhs,
427 const sub_match<BidirectionalIterator>& rhs);
429 [*Effects]: returns `lhs.compare(rhs) < 0`.
431 [#boost_regex.sub_match.op_compare4]
433 template <class BidirectionalIterator>
434 bool operator <= (const sub_match<BidirectionalIterator>& lhs,
435 const sub_match<BidirectionalIterator>& rhs);
437 [*Effects]: returns `lhs.compare(rhs) <= 0`.
439 [#boost_regex.sub_match.op_compare5]
441 template <class BidirectionalIterator>
442 bool operator >= (const sub_match<BidirectionalIterator>& lhs,
443 const sub_match<BidirectionalIterator>& rhs);
445 [*Effects]: returns `lhs.compare(rhs) >= 0`.
447 [#boost_regex.sub_match.op_compare6]
449 template <class BidirectionalIterator>
450 bool operator > (const sub_match<BidirectionalIterator>& lhs,
451 const sub_match<BidirectionalIterator>& rhs);
453 [*Effects]: returns `lhs.compare(rhs) > 0`.
455 [#boost_regex.sub_match.op_compare7]
457 template <class BidirectionalIterator, class traits, class Allocator>
458 bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
461 const sub_match<BidirectionalIterator>& rhs);
463 [*Effects]: returns `lhs == rhs.str()`.
465 [#boost_regex.sub_match.op_compare8]
467 template <class BidirectionalIterator, class traits, class Allocator>
468 bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
471 const sub_match<BidirectionalIterator>& rhs);
473 [*Effects]: returns `lhs != rhs.str()`.
475 [#boost_regex.sub_match.op_compare9]
477 template <class BidirectionalIterator, class traits, class Allocator>
478 bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
481 const sub_match<BidirectionalIterator>& rhs);
483 [*Effects]: returns `lhs < rhs.str()`.
485 [#boost_regex.sub_match.op_compare10]
487 template <class BidirectionalIterator, class traits, class Allocator>
488 bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
491 const sub_match<BidirectionalIterator>& rhs);
493 [*Effects]: returns `lhs > rhs.str()`.
495 [#boost_regex.sub_match.op_compare11]
497 template <class BidirectionalIterator, class traits, class Allocator>
498 bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
501 const sub_match<BidirectionalIterator>& rhs);
503 [*Effects]: returns `lhs >= rhs.str()`.
505 [#boost_regex.sub_match.op_compare12]
507 template <class BidirectionalIterator, class traits, class Allocator>
508 bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
511 const sub_match<BidirectionalIterator>& rhs);
513 [*Effects]: returns `lhs <= rhs.str()`.
515 [#boost_regex.sub_match.op_compare13]
517 template <class BidirectionalIterator, class traits, class Allocator>
518 bool operator == (const sub_match<BidirectionalIterator>& lhs,
519 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
523 [*Effects]: returns `lhs.str() == rhs`.
525 [#boost_regex.sub_match.op_compare14]
527 template <class BidirectionalIterator, class traits, class Allocator>
528 bool operator != (const sub_match<BidirectionalIterator>& lhs,
529 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
533 [*Effects]: returns `lhs.str() != rhs`.
535 [#boost_regex.sub_match.op_compare15]
537 template <class BidirectionalIterator, class traits, class Allocator>
538 bool operator < (const sub_match<BidirectionalIterator>& lhs,
539 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
543 [*Effects]: returns `lhs.str() < rhs`.
545 [#boost_regex.sub_match.op_compare16]
547 template <class BidirectionalIterator, class traits, class Allocator>
548 bool operator > (const sub_match<BidirectionalIterator>& lhs,
549 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
553 [*Effects]: returns `lhs.str() > rhs`.
555 [#boost_regex.sub_match.op_compare17]
557 template <class BidirectionalIterator, class traits, class Allocator>
558 bool operator >= (const sub_match<BidirectionalIterator>& lhs,
559 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
563 [*Effects]: returns `lhs.str() >= rhs`.
565 [#boost_regex.sub_match.op_compare18]
567 template <class BidirectionalIterator, class traits, class Allocator>
568 bool operator <= (const sub_match<BidirectionalIterator>& lhs,
569 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
573 [*Effects]: returns `lhs.str() <= rhs`.
575 [#boost_regex.sub_match.op_compare19]
577 template <class BidirectionalIterator>
578 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
579 const sub_match<BidirectionalIterator>& rhs);
581 [*Effects]: returns `lhs == rhs.str()`.
583 [#boost_regex.sub_match.op_compare20]
585 template <class BidirectionalIterator>
586 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
587 const sub_match<BidirectionalIterator>& rhs);
589 [*Effects]: returns `lhs != rhs.str()`.
591 [#boost_regex.sub_match.op_compare21]
593 template <class BidirectionalIterator>
594 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
595 const sub_match<BidirectionalIterator>& rhs);
597 [*Effects]: returns `lhs < rhs.str()`.
599 [#boost_regex.sub_match.op_compare22]
601 template <class BidirectionalIterator>
602 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
603 const sub_match<BidirectionalIterator>& rhs);
605 [*Effects]: returns `lhs > rhs.str()`.
607 [#boost_regex.sub_match.op_compare23]
609 template <class BidirectionalIterator>
610 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
611 const sub_match<BidirectionalIterator>& rhs);
613 [*Effects]: returns `lhs >= rhs.str()`.
615 [#boost_regex.sub_match.op_compare24]
617 template <class BidirectionalIterator>
618 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
619 const sub_match<BidirectionalIterator>& rhs);
621 [*Effects]: returns `lhs <= rhs.str()`.
623 [#boost_regex.sub_match.op_compare25]
625 template <class BidirectionalIterator>
626 bool operator == (const sub_match<BidirectionalIterator>& lhs,
627 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
629 [*Effects]: returns `lhs.str() == rhs`.
631 [#boost_regex.sub_match.op_compare26]
633 template <class BidirectionalIterator>
634 bool operator != (const sub_match<BidirectionalIterator>& lhs,
635 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
637 [*Effects]: returns `lhs.str() != rhs`.
639 [#boost_regex.sub_match.op_compare27]
641 template <class BidirectionalIterator>
642 bool operator < (const sub_match<BidirectionalIterator>& lhs,
643 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
645 [*Effects]: returns `lhs.str() < rhs`.
647 [#boost_regex.sub_match.op_compare28]
649 template <class BidirectionalIterator>
650 bool operator > (const sub_match<BidirectionalIterator>& lhs,
651 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
653 [*Effects]: returns `lhs.str() > rhs`.
655 [#boost_regex.sub_match.op_compare29]
657 template <class BidirectionalIterator>
658 bool operator >= (const sub_match<BidirectionalIterator>& lhs,
659 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
661 [*Effects]: returns `lhs.str() >= rhs`.
663 [#boost_regex.sub_match.op_compare30]
665 template <class BidirectionalIterator>
666 bool operator <= (const sub_match<BidirectionalIterator>& lhs,
667 typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
669 [*Effects]: returns `lhs.str() <= rhs`.
671 [#boost_regex.sub_match.op_compare31]
673 template <class BidirectionalIterator>
674 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
675 const sub_match<BidirectionalIterator>& rhs);
677 [*Effects]: returns `lhs == rhs.str()`.
679 [#boost_regex.sub_match.op_compare32]
681 template <class BidirectionalIterator>
682 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
683 const sub_match<BidirectionalIterator>& rhs);
685 [*Effects]: returns `lhs != rhs.str()`.
687 [#boost_regex.sub_match.op_compare33]
689 template <class BidirectionalIterator>
690 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
691 const sub_match<BidirectionalIterator>& rhs);
693 [*Effects]: returns `lhs < rhs.str()`.
695 [#boost_regex.sub_match.op_compare34]
697 template <class BidirectionalIterator>
698 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
699 const sub_match<BidirectionalIterator>& rhs);
701 [*Effects]: returns `lhs > rhs.str()`.
703 [#boost_regex.sub_match.op_compare35]
705 template <class BidirectionalIterator>
706 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
707 const sub_match<BidirectionalIterator>& rhs);
709 [*Effects]: returns `lhs >= rhs.str()`.
711 [#boost_regex.sub_match.op_compare36]
713 template <class BidirectionalIterator>
714 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
715 const sub_match<BidirectionalIterator>& rhs);
717 [*Effects]: returns `lhs <= rhs.str()`.
719 [#boost_regex.sub_match.op_compare37]
721 template <class BidirectionalIterator>
722 bool operator == (const sub_match<BidirectionalIterator>& lhs,
723 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
725 [*Effects]: returns `lhs.str() == rhs`.
727 [#boost_regex.sub_match.op_compare38]
729 template <class BidirectionalIterator>
730 bool operator != (const sub_match<BidirectionalIterator>& lhs,
731 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
733 [*Effects]: returns `lhs.str() != rhs`.
735 [#boost_regex.sub_match.op_compare39]
737 template <class BidirectionalIterator>
738 bool operator < (const sub_match<BidirectionalIterator>& lhs,
739 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
741 [*Effects]: returns `lhs.str() < rhs`.
743 [#boost_regex.sub_match.op_compare40]
745 template <class BidirectionalIterator>
746 bool operator > (const sub_match<BidirectionalIterator>& lhs,
747 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
749 [*Effects]: returns `lhs.str() > rhs`.
751 [#boost_regex.sub_match.op_compare41]
753 template <class BidirectionalIterator>
754 bool operator >= (const sub_match<BidirectionalIterator>& lhs,
755 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
757 [*Effects]: returns `lhs.str() >= rhs`.
759 [#boost_regex.sub_match.op_compare42]
761 template <class BidirectionalIterator>
762 bool operator <= (const sub_match<BidirectionalIterator>& lhs,
763 typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
765 [*Effects]: returns `lhs.str() <= rhs`.
767 The addition operators for [sub_match] allow you to add a [sub_match]
768 to any type to which you can add a `std::string` and obtain a new
769 string as the result.
771 [#boost_regex.sub_match.op_add1]
773 template <class BidirectionalIterator, class traits, class Allocator>
774 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
775 operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
778 const sub_match<BidirectionalIterator>& m);
780 [*Effects]: returns `s + m.str()`.
782 [#boost_regex.sub_match.op_add2]
784 template <class BidirectionalIterator, class traits, class Allocator>
785 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
786 operator + (const sub_match<BidirectionalIterator>& m,
787 const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
791 [*Effects]: returns `m.str() + s`.
793 [#boost_regex.sub_match.op_add3]
795 template <class BidirectionalIterator>
796 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
797 operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
798 const sub_match<BidirectionalIterator>& m);
800 [*Effects]: returns `s + m.str()`.
802 [#boost_regex.sub_match.op_add4]
804 template <class BidirectionalIterator>
805 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
806 operator + (const sub_match<BidirectionalIterator>& m,
807 typename iterator_traits<BidirectionalIterator>::value_type const * s);
809 [*Effects]: returns `m.str() + s`.
811 [#boost_regex.sub_match.op_add5]
813 template <class BidirectionalIterator>
814 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
815 operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
816 const sub_match<BidirectionalIterator>& m);
818 [*Effects]: returns `s + m.str()`.
820 [#boost_regex.sub_match.op_add6]
822 template <class BidirectionalIterator>
823 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
824 operator + (const sub_match<BidirectionalIterator>& m,
825 typename iterator_traits<BidirectionalIterator>::value_type const& s);
827 [*Effects]: returns `m.str() + s`.
829 [#boost_regex.sub_match.op_add7]
831 template <class BidirectionalIterator>
832 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
833 operator + (const sub_match<BidirectionalIterator>& m1,
834 const sub_match<BidirectionalIterator>& m2);
836 [*Effects]: returns `m1.str() + m2.str()`.
840 [#boost_regex.sub_match.op_stream]
842 template <class charT, class traits, class BidirectionalIterator>
843 basic_ostream<charT, traits>&
844 operator << (basic_ostream<charT, traits>& os
845 const sub_match<BidirectionalIterator>& m);
847 [*Effects]: returns `(os << m.str())`.