match_result.qbk 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. [/
  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).
  6. ]
  7. [section:match_results match_results]
  8. [h4 Synopsis]
  9. #include <boost/regex.hpp>
  10. Regular expressions are different from many simple pattern-matching algorithms
  11. in that as well as finding an overall match they can also produce
  12. sub-expression matches: each sub-expression being delimited in the
  13. pattern by a pair of parenthesis (...). There has to be some method for
  14. reporting sub-expression matches back to the user: this is achieved this by
  15. defining a class `match_results` that acts as an indexed collection of
  16. sub-expression matches, each sub-expression match being contained in an
  17. object of type [sub_match].
  18. Template class `match_results` denotes a collection of character
  19. sequences representing the result of a regular expression match. Objects of
  20. type `match_results` are passed to the algorithms [regex_match] and [regex_search],
  21. and are returned by the iterator [regex_iterator]. Storage for the
  22. collection is allocated and freed as necessary by the member functions of
  23. class `match_results`.
  24. The template class `match_results` conforms to the requirements of a Sequence,
  25. as specified in (lib.sequence.reqmts), except that only operations defined for
  26. const-qualified Sequences are supported.
  27. Class template `match_results` is most commonly used as one of the typedefs
  28. `cmatch`, `wcmatch`, `smatch`, or `wsmatch`:
  29. template <class BidirectionalIterator,
  30. class Allocator = std::allocator<sub_match<BidirectionalIterator> >
  31. class match_results;
  32. typedef match_results<const char*> cmatch;
  33. typedef match_results<const wchar_t*> wcmatch;
  34. typedef match_results<string::const_iterator> smatch;
  35. typedef match_results<wstring::const_iterator> wsmatch;
  36. template <class BidirectionalIterator,
  37. class Allocator = std::allocator<sub_match<BidirectionalIterator> >
  38. class match_results
  39. {
  40. public:
  41. typedef sub_match<BidirectionalIterator> value_type;
  42. typedef const value_type& const_reference;
  43. typedef const_reference reference;
  44. typedef implementation defined const_iterator;
  45. typedef const_iterator iterator;
  46. typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
  47. typedef typename Allocator::size_type size_type;
  48. typedef Allocator allocator_type;
  49. typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
  50. typedef basic_string<char_type> string_type;
  51. // construct/copy/destroy:
  52. ``[link boost_regex.match_results.construct explicit match_results]``(const Allocator& a = Allocator());
  53. ``[link boost_regex.match_results.copy_construct match_results]``(const match_results& m);
  54. ``[link boost_regex.match_results.assign match_results& operator=]``(const match_results& m);
  55. ~match_results();
  56. // size:
  57. size_type ``[link boost_regex.match_results.size size]``() const;
  58. size_type ``[link boost_regex.match_results.max_size max_size]``() const;
  59. bool ``[link boost_regex.match_results.empty empty]``() const;
  60. // element access:
  61. difference_type ``[link boost_regex.match_results.length length]``(int sub = 0) const;
  62. difference_type ``[link boost_regex.match_results.length length]``(const char_type* sub) const;
  63. template <class charT>
  64. difference_type ``[link boost_regex.match_results.length length]``(const charT* sub) const;
  65. template <class charT, class Traits, class A>
  66. difference_type ``[link boost_regex.match_results.length length]``(const std::basic_string<charT, Traits, A>& sub) const;
  67. difference_type ``[link boost_regex.match_results.position position]``(unsigned int sub = 0) const;
  68. difference_type ``[link boost_regex.match_results.position position]``(const char_type* sub) const;
  69. template <class charT>
  70. difference_type ``[link boost_regex.match_results.position position]``(const charT* sub) const;
  71. template <class charT, class Traits, class A>
  72. difference_type ``[link boost_regex.match_results.position position]``(const std::basic_string<charT, Traits, A>& sub) const;
  73. string_type ``[link boost_regex.match_results.str str]``(int sub = 0) const;
  74. string_type ``[link boost_regex.match_results.str str]``(const char_type* sub)const;
  75. template <class Traits, class A>
  76. string_type ``[link boost_regex.match_results.str str]``(const std::basic_string<char_type, Traits, A>& sub)const;
  77. template <class charT>
  78. string_type ``[link boost_regex.match_results.str str]``(const charT* sub)const;
  79. template <class charT, class Traits, class A>
  80. string_type ``[link boost_regex.match_results.str str]``(const std::basic_string<charT, Traits, A>& sub)const;
  81. const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(int n) const;
  82. const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const char_type* n) const;
  83. template <class Traits, class A>
  84. const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const std::basic_string<char_type, Traits, A>& n) const;
  85. template <class charT>
  86. const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const charT* n) const;
  87. template <class charT, class Traits, class A>
  88. const_reference ``[link boost_regex.match_results.subscript operator\[\]]``(const std::basic_string<charT, Traits, A>& n) const;
  89. const_reference ``[link boost_regex.match_results.prefix prefix]``() const;
  90. const_reference ``[link boost_regex.match_results.suffix suffix]``() const;
  91. const_iterator ``[link boost_regex.match_results.begin begin]``() const;
  92. const_iterator ``[link boost_regex.match_results.end end]``() const;
  93. // format:
  94. template <class OutputIterator, class Formatter>
  95. OutputIterator ``[link boost_regex.match_results.format format]``(OutputIterator out,
  96. Formatter fmt,
  97. match_flag_type flags = format_default) const;
  98. template <class Formatter>
  99. string_type ``[link boost_regex.match_results.format2 format]``(Formatter fmt,
  100. match_flag_type flags = format_default) const;
  101. allocator_type ``[link boost_regex.match_results.get_allocator get_allocator]``() const;
  102. void ``[link boost_regex.match_results.swap swap]``(match_results& that);
  103. #ifdef BOOST_REGEX_MATCH_EXTRA
  104. typedef typename value_type::capture_sequence_type capture_sequence_type;
  105. const capture_sequence_type& ``[link boost_regex.match_results.captures captures]``(std::size_t i)const;
  106. #endif
  107. };
  108. template <class BidirectionalIterator, class Allocator>
  109. bool ``[link boost_regex.match_results.op_eq operator ==]`` (const match_results<BidirectionalIterator, Allocator>& m1,
  110. const match_results<BidirectionalIterator, Allocator>& m2);
  111. template <class BidirectionalIterator, class Allocator>
  112. bool ``[link boost_regex.match_results.op_ne operator !=]`` (const match_results<BidirectionalIterator, Allocator>& m1,
  113. const match_results<BidirectionalIterator, Allocator>& m2);
  114. template <class charT, class traits, class BidirectionalIterator, class Allocator>
  115. basic_ostream<charT, traits>&
  116. ``[link boost_regex.match_results.op_stream operator <<]`` (basic_ostream<charT, traits>& os,
  117. const match_results<BidirectionalIterator, Allocator>& m);
  118. template <class BidirectionalIterator, class Allocator>
  119. void ``[link boost_regex.match_results.op_swap swap]``(match_results<BidirectionalIterator, Allocator>& m1,
  120. match_results<BidirectionalIterator, Allocator>& m2);
  121. [h4 Description]
  122. In all `match_results` constructors, a copy of the Allocator argument is used
  123. for any memory allocation performed by the constructor or member functions
  124. during the lifetime of the object.
  125. [#boost_regex.match_results.construct]
  126. match_results(const Allocator& a = Allocator());
  127. [*Effects]: Constructs an object of class `match_results`. The postconditions of
  128. this function are indicated in the table:
  129. [table
  130. [[Element][Value]]
  131. [[empty()][true]]
  132. [[size()][0]]
  133. [[str()][basic_string<charT>()]]
  134. ]
  135. [#boost_regex.match_results.copy_construct]
  136. match_results(const match_results& m);
  137. [*Effects]: Constructs an object of class match_results, as a copy of m.
  138. [#boost_regex.match_results.assign]
  139. match_results& operator=(const match_results& m);
  140. [*Effects]: Assigns m to *this. The postconditions of this function are
  141. indicated in the table:
  142. [table
  143. [[Element][Value]]
  144. [[empty()][m.empty().]]
  145. [[size()][m.size().]]
  146. [[str(n)][m.str(n) for all integers n < m.size().]]
  147. [[prefix()][m.prefix().]]
  148. [[suffix()][m.suffix().]]
  149. [[(*this)\[n\]][m\[n\] for all integers n < m.size().]]
  150. [[length(n)][m.length(n) for all integers n < m.size().]]
  151. [[position(n)][m.position(n) for all integers n < m.size().]]
  152. ]
  153. [#boost_regex.match_results.size]
  154. size_type size()const;
  155. [*Effects]: Returns the number of [sub_match] elements stored in *this; that is
  156. the number of marked sub-expressions in the regular expression that was
  157. matched plus one.
  158. [#boost_regex.match_results.max_size]
  159. size_type max_size()const;
  160. [*Effects]: Returns the maximum number of [sub_match] elements that can be
  161. stored in *this.
  162. [#boost_regex.match_results.empty]
  163. bool empty()const;
  164. [*Effects]: Returns size() == 0.
  165. [#boost_regex.match_results.length]
  166. difference_type length(int sub = 0)const;
  167. difference_type length(const char_type* sub)const;
  168. template <class charT>
  169. difference_type length(const charT* sub)const;
  170. template <class charT, class Traits, class A>
  171. difference_type length(const std::basic_string<charT, Traits, A>&)const;
  172. [*Requires]: that the match_results object has been initialized as a result of a
  173. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  174. that the underlying iterators have not been subsequently invalidated. Will raise a
  175. `std::logic_error` if the match_results object was not initialized.
  176. [*Effects]: Returns the length of sub-expression /sub/, that is to say:
  177. `(*this)[sub].length()`.
  178. The overloads that accept a string refer to a named sub-expression /n/.
  179. In the event that there is no such named sub-expression then returns zero.
  180. The template overloads of this function, allow the string and\/or character type
  181. to be different from the character type of the underlying sequence and\/or regular expression:
  182. in this case the characters will be widened to the underlying character type of the original regular expression.
  183. A compiler error will occur if the argument passes a wider character type than the underlying sequence.
  184. These overloads allow a normal narrow character C string literal to be used as an argument, even when
  185. the underlying character type of the expression being matched may be something more exotic such as a
  186. Unicode character type.
  187. [#boost_regex.match_results.position]
  188. difference_type position(unsigned int sub = 0)const;
  189. difference_type position(const char_type* sub)const;
  190. template <class charT>
  191. difference_type position(const charT* sub)const;
  192. template <class charT, class Traits, class A>
  193. difference_type position(const std::basic_string<charT, Traits, A>&)const;
  194. [*Requires]: that the match_results object has been initialized as a result of a
  195. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  196. that the underlying iterators have not been subsequently invalidated. Will raise a
  197. `std::logic_error` if the match_results object was not initialized.
  198. [*Effects]: Returns the starting location of sub-expression /sub/, or -1 if /sub/ was
  199. not matched. Note that if this represents a partial match , then `position()`
  200. will return the location of the partial match even though `(*this)[0].matched` is false.
  201. The overloads that accept a string refer to a named sub-expression /n/.
  202. In the event that there is no such named sub-expression then returns -1.
  203. The template overloads of this function, allow the string and\/or character type
  204. to be different from the character type of the underlying sequence and\/or regular expression:
  205. in this case the characters will be widened to the underlying character type of the original regular expression.
  206. A compiler error will occur if the argument passes a wider character type than the underlying sequence.
  207. These overloads allow a normal narrow character C string literal to be used as an argument, even when
  208. the underlying character type of the expression being matched may be something more exotic such as a
  209. Unicode character type.
  210. [#boost_regex.match_results.str]
  211. string_type str(int sub = 0)const;
  212. string_type str(const char_type* sub)const;
  213. template <class Traits, class A>
  214. string_type str(const std::basic_string<char_type, Traits, A>& sub)const;
  215. template <class charT>
  216. string_type str(const charT* sub)const;
  217. template <class charT, class Traits, class A>
  218. string_type str(const std::basic_string<charT, Traits, A>& sub)const;
  219. [*Requires]: that the match_results object has been initialized as a result of a
  220. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  221. that the underlying iterators have not been subsequently invalidated. Will raise a
  222. `std::logic_error` if the match_results object was not initialized.
  223. [*Effects]: Returns sub-expression /sub/ as a string: `string_type((*this)[sub])`.
  224. The overloads that accept a string, return the string that matched the named sub-expression /n/.
  225. In the event that there is no such named sub-expression then returns an empty string.
  226. The template overloads of this function, allow the string and\/or character type
  227. to be different from the character type of the underlying sequence and\/or regular expression:
  228. in this case the characters will be widened to the underlying character type of the original regular expression.
  229. A compiler error will occur if the argument passes a wider character type than the underlying sequence.
  230. These overloads allow a normal narrow character C string literal to be used as an argument, even when
  231. the underlying character type of the expression being matched may be something more exotic such as a
  232. Unicode character type.
  233. [#boost_regex.match_results.subscript]
  234. const_reference operator[](int n) const;
  235. const_reference operator[](const char_type* n) const;
  236. template <class Traits, class A>
  237. const_reference operator[](const std::basic_string<char_type, Traits, A>& n) const;
  238. template <class charT>
  239. const_reference operator[](const charT* n) const;
  240. template <class charT, class Traits, class A>
  241. const_reference operator[](const std::basic_string<charT, Traits, A>& n) const;
  242. [*Requires]: that the match_results object has been initialized as a result of a
  243. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  244. that the underlying iterators have not been subsequently invalidated. Will raise a
  245. `std::logic_error` if the match_results object was not initialized.
  246. [*Effects]: Returns a reference to the [sub_match] object representing the character
  247. sequence that matched marked sub-expression /n/. If `n == 0` then returns a
  248. reference to a [sub_match] object representing the character sequence that
  249. matched the whole regular expression. If /n/ is out of range, or if /n/ is an
  250. unmatched sub-expression, then returns a [sub_match] object whose matched
  251. member is false.
  252. The overloads that accept a string, return a reference to the [sub_match]
  253. object representing the character sequence that matched the named sub-expression /n/.
  254. In the event that there is no such named sub-expression then returns a [sub_match] object whose matched
  255. member is false.
  256. The template overloads of this function, allow the string and\/or character type
  257. to be different from the character type of the underlying sequence and\/or regular expression:
  258. in this case the characters will be widened to the underlying character type of the original regular expression.
  259. A compiler error will occur if the argument passes a wider character type than the underlying sequence.
  260. These overloads allow a normal narrow character C string literal to be used as an argument, even when
  261. the underlying character type of the expression being matched may be something more exotic such as a
  262. Unicode character type.
  263. [#boost_regex.match_results.prefix]
  264. const_reference prefix()const;
  265. [*Requires]: that the match_results object has been initialized as a result of a
  266. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  267. that the underlying iterators have not been subsequently invalidated. Will raise a
  268. `std::logic_error` if the match_results object was not initialized.
  269. [*Effects]: Returns a reference to the [sub_match] object representing the
  270. character sequence from the start of the string being matched or searched, to the
  271. start of the match found.
  272. [#boost_regex.match_results.suffix]
  273. const_reference suffix()const;
  274. [*Requires]: that the match_results object has been initialized as a result of a
  275. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  276. that the underlying iterators have not been subsequently invalidated. Will raise a
  277. `std::logic_error` if the match_results object was not initialized.
  278. [*Effects]: Returns a reference to the [sub_match] object representing the
  279. character sequence from the end of the match found to the end of the
  280. string being matched or searched.
  281. [#boost_regex.match_results.begin]
  282. const_iterator begin()const;
  283. [*Effects]: Returns a starting iterator that enumerates over all the marked
  284. sub-expression matches stored in *this.
  285. [#boost_regex.match_results.end]
  286. const_iterator end()const;
  287. [*Effects]: Returns a terminating iterator that enumerates over all the
  288. marked sub-expression matches stored in *this.
  289. [#boost_regex.match_results_format]
  290. [#boost_regex.match_results.format]
  291. template <class OutputIterator, class Formatter>
  292. OutputIterator format(OutputIterator out,
  293. Formatter fmt,
  294. match_flag_type flags = format_default);
  295. [*Requires]: The type `OutputIterator` conforms to the Output Iterator requirements
  296. (C++ std 24.1.2).
  297. The type `Formatter` must be either a pointer to a null-terminated string
  298. of type `char_type[]`, or be a container of `char_type`'s (for example
  299. `std::basic_string<char_type>`) or be a unary, binary or ternary functor
  300. that computes the replacement string from a function call: either
  301. `fmt(*this)` which must return a container of `char_type`'s to be used as the
  302. replacement text, or either `fmt(*this, out)` or `fmt(*this, out, flags)`, both of
  303. which write the replacement text to `*out`, and then return the new
  304. OutputIterator position. Note that if the formatter is a functor, then it is
  305. ['passed by value]: users that want to pass function objects with internal state
  306. might want to use [@../../../../doc/html/ref.html Boost.Ref] to wrap the object so
  307. that it's passed by reference.
  308. [*Requires]: that the match_results object has been initialized as a result of a
  309. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  310. that the underlying iterators have not been subsequently invalidated. Will raise a
  311. `std::logic_error` if the match_results object was not initialized.
  312. [*Effects]: If `fmt` is either a null-terminated string, or a
  313. container of `char_type`'s, then copies the character sequence `[fmt.begin(), fmt.end())` to
  314. `OutputIterator` /out/. For each format specifier or escape sequence in
  315. /fmt/, replace that sequence with either the character(s) it represents,
  316. or the sequence of characters within `*this` to which it refers.
  317. The bitmasks specified in flags determines what format specifiers or
  318. escape sequences are recognized, by default this is the format used by
  319. ECMA-262, ECMAScript Language Specification, Chapter 15 part
  320. 5.4.11 String.prototype.replace.
  321. If `fmt` is a function object, then depending on the number of arguments
  322. the function object accepts, it will either:
  323. * Call `fmt(*this)` and copy the string returned to `OutputIterator`
  324. /out/.
  325. * Call `fmt(*this, out)`.
  326. * Call `fmt(*this, out, flags)`.
  327. In all cases the new position of the `OutputIterator` is returned.
  328. See the [link boost_regex.format format syntax guide for more information].
  329. [*Returns]: out.
  330. [#boost_regex.match_results.format2]
  331. template <class Formatter>
  332. string_type format(Formatter fmt,
  333. match_flag_type flags = format_default);
  334. [*Requires]
  335. The type `Formatter` must be either a pointer to a null-terminated string
  336. of type `char_type[]`, or be a container of `char_type`'s (for example
  337. `std::basic_string<char_type>`) or be a unary, binary or ternary functor
  338. that computes the replacement string from a function call: either
  339. `fmt(*this)` which must return a container of `char_type`'s to be used as the
  340. replacement text, or either `fmt(*this, out)` or `fmt(*this, out, flags)`, both of
  341. which write the replacement text to `*out`, and then return the new
  342. OutputIterator position.
  343. [*Requires]: that the match_results object has been initialized as a result of a
  344. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  345. that the underlying iterators have not been subsequently invalidated. Will raise a
  346. `std::logic_error` if the match_results object was not initialized.
  347. [*Effects]:
  348. If `fmt` is either a null-terminated string, or a
  349. container of `char_type`'s, then copies the string /fmt/: For each format specifier or
  350. escape sequence in /fmt/, replace that sequence with either the
  351. character(s) it represents, or the sequence of characters within `*this` to
  352. which it refers. The bitmasks specified in flags determines what format
  353. specifiers or escape sequences are recognized, by default this is the format
  354. used by ECMA-262, ECMAScript Language Specification, Chapter 15 part
  355. 5.4.11 String.prototype.replace.
  356. If `fmt` is a function object, then depending on the number of arguments
  357. the function object accepts, it will either:
  358. * Call `fmt(*this)` and return the result.
  359. * Call `fmt(*this, unspecified-output-iterator)`, where `unspecified-output-iterator`
  360. is an unspecified OutputIterator type used to copy the output to the string result.
  361. * Call `fmt(*this, unspecified-output-iterator, flags)`, where `unspecified-output-iterator`
  362. is an unspecified OutputIterator type used to copy the output to the string result.
  363. See the [link boost_regex.format format syntax guide for more information].
  364. [#boost_regex.match_results.get_allocator]
  365. allocator_type get_allocator()const;
  366. [*Effects]: Returns a copy of the Allocator that was passed to the object's constructor.
  367. [#boost_regex.match_results.swap]
  368. void swap(match_results& that);
  369. [*Effects]: Swaps the contents of the two sequences.
  370. [*Postcondition]: *this contains the sequence of matched sub-expressions that were in that, that contains the sequence of matched sub-expressions that were in *this.
  371. [*Complexity]: constant time.
  372. [#boost_regex.match_results.capture_type]
  373. typedef typename value_type::capture_sequence_type capture_sequence_type;
  374. Defines an implementation-specific type that satisfies the requirements of
  375. a standard library Sequence (21.1.1 including the optional Table 68 operations),
  376. whose value_type is a `sub_match<BidirectionalIterator>`. This type happens to be
  377. `std::vector<sub_match<BidirectionalIterator> >`, but you shouldn't actually
  378. rely on that.
  379. [#boost_regex.match_results.captures]
  380. const capture_sequence_type& captures(std::size_t i)const;
  381. [*Requires]: that the match_results object has been initialized as a result of a
  382. successful call to [regex_search] or [regex_match] or was returned from a [regex_iterator], and
  383. that the underlying iterators have not been subsequently invalidated. Will raise a
  384. `std::logic_error` if the match_results object was not initialized.
  385. [*Effects]: returns a sequence containing all the captures obtained for sub-expression i.
  386. [*Returns]: `(*this)[i].captures();`
  387. [*Preconditions]: the library must be built and used with BOOST_REGEX_MATCH_EXTRA defined,
  388. and you must pass the flag match_extra to the regex matching functions
  389. ([regex_match], [regex_search], [regex_iterator] or [regex_token_iterator]) in
  390. order for this member function to be defined and return useful information.
  391. [*Rationale]: Enabling this feature has several consequences:
  392. * sub_match occupies more memory resulting in complex expressions running out of memory or stack space more quickly during matching.
  393. * The matching algorithms are less efficient at handling some features (independent sub-expressions for example), even when match_extra is not used.
  394. * 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.
  395. [#boost_regex.match_results.op_eq]
  396. template <class BidirectionalIterator, class Allocator>
  397. bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
  398. const match_results<BidirectionalIterator, Allocator>& m2);
  399. [*Effects]: Compares the two sequences for equality.
  400. [#boost_regex.match_results.op_ne]
  401. template <class BidirectionalIterator, class Allocator>
  402. bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
  403. const match_results<BidirectionalIterator, Allocator>& m2);
  404. [*Effects]: Compares the two sequences for inequality.
  405. [#boost_regex.match_results.op_stream]
  406. template <class charT, class traits, class BidirectionalIterator, class Allocator>
  407. basic_ostream<charT, traits>&
  408. operator << (basic_ostream<charT, traits>& os,
  409. const match_results<BidirectionalIterator, Allocator>& m);
  410. [*Effects]: Writes the contents of /m/ to the stream /os/ as if by calling
  411. `os << m.str()`; Returns /os/.
  412. [#boost_regex.match_results.op_swap]
  413. template <class BidirectionalIterator, class Allocator>
  414. void swap(match_results<BidirectionalIterator, Allocator>& m1,
  415. match_results<BidirectionalIterator, Allocator>& m2);
  416. [*Effects]: Swaps the contents of the two sequences.
  417. [endsect]