1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>match_results</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Boost.Regex 5.1.4"> 8<link rel="up" href="../ref.html" title="Reference"> 9<link rel="prev" href="basic_regex.html" title="basic_regex"> 10<link rel="next" href="sub_match.html" title="sub_match"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="basic_regex.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sub_match.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_regex.ref.match_results"></a><a class="link" href="match_results.html" title="match_results">match_results</a> 28</h3></div></div></div> 29<h5> 30<a name="boost_regex.ref.match_results.h0"></a> 31 <span class="phrase"><a name="boost_regex.ref.match_results.synopsis"></a></span><a class="link" href="match_results.html#boost_regex.ref.match_results.synopsis">Synopsis</a> 32 </h5> 33<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 34</pre> 35<p> 36 Regular expressions are different from many simple pattern-matching algorithms 37 in that as well as finding an overall match they can also produce sub-expression 38 matches: each sub-expression being delimited in the pattern by a pair of 39 parenthesis (...). There has to be some method for reporting sub-expression 40 matches back to the user: this is achieved this by defining a class <code class="computeroutput"><span class="identifier">match_results</span></code> that acts as an indexed collection 41 of sub-expression matches, each sub-expression match being contained in an 42 object of type <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a>. 43 </p> 44<p> 45 Template class <code class="computeroutput"><span class="identifier">match_results</span></code> 46 denotes a collection of character sequences representing the result of a 47 regular expression match. Objects of type <code class="computeroutput"><span class="identifier">match_results</span></code> 48 are passed to the algorithms <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> and <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, and are returned by 49 the iterator <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>. Storage for the 50 collection is allocated and freed as necessary by the member functions of 51 class <code class="computeroutput"><span class="identifier">match_results</span></code>. 52 </p> 53<p> 54 The template class <code class="computeroutput"><span class="identifier">match_results</span></code> 55 conforms to the requirements of a Sequence, as specified in (lib.sequence.reqmts), 56 except that only operations defined for const-qualified Sequences are supported. 57 </p> 58<p> 59 Class template <code class="computeroutput"><span class="identifier">match_results</span></code> 60 is most commonly used as one of the typedefs <code class="computeroutput"><span class="identifier">cmatch</span></code>, 61 <code class="computeroutput"><span class="identifier">wcmatch</span></code>, <code class="computeroutput"><span class="identifier">smatch</span></code>, 62 or <code class="computeroutput"><span class="identifier">wsmatch</span></code>: 63 </p> 64<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> 65 <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span> 66<span class="keyword">class</span> <span class="identifier">match_results</span><span class="special">;</span> 67 68<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*></span> <span class="identifier">cmatch</span><span class="special">;</span> 69<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*></span> <span class="identifier">wcmatch</span><span class="special">;</span> 70<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">smatch</span><span class="special">;</span> 71<span class="keyword">typedef</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">wstring</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">></span> <span class="identifier">wsmatch</span><span class="special">;</span> 72 73<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> 74 <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span> 75<span class="keyword">class</span> <span class="identifier">match_results</span> 76<span class="special">{</span> 77<span class="keyword">public</span><span class="special">:</span> 78 <span class="keyword">typedef</span> <span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="identifier">value_type</span><span class="special">;</span> 79 <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">const_reference</span><span class="special">;</span> 80 <span class="keyword">typedef</span> <span class="identifier">const_reference</span> <span class="identifier">reference</span><span class="special">;</span> 81 <span class="keyword">typedef</span> <span class="identifier">implementation</span> <span class="identifier">defined</span> <span class="identifier">const_iterator</span><span class="special">;</span> 82 <span class="keyword">typedef</span> <span class="identifier">const_iterator</span> <span class="identifier">iterator</span><span class="special">;</span> 83 <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span> 84 <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Allocator</span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span> 85 <span class="keyword">typedef</span> <span class="identifier">Allocator</span> <span class="identifier">allocator_type</span><span class="special">;</span> 86 <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">iterator_traits</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">>::</span><span class="identifier">value_type</span> <span class="identifier">char_type</span><span class="special">;</span> 87 <span class="keyword">typedef</span> <span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">></span> <span class="identifier">string_type</span><span class="special">;</span> 88 89 <span class="comment">// construct/copy/destroy:</span> 90 <a class="link" href="match_results.html#boost_regex.match_results.construct">explicit match_results</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Allocator</span><span class="special">&</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">Allocator</span><span class="special">());</span> 91 <a class="link" href="match_results.html#boost_regex.match_results.copy_construct">match_results</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span> 92 <a class="link" href="match_results.html#boost_regex.match_results.assign">match_results& operator=</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span> 93 <span class="special">~</span><span class="identifier">match_results</span><span class="special">();</span> 94 95 <span class="comment">// size:</span> 96 <span class="identifier">size_type</span> <a class="link" href="match_results.html#boost_regex.match_results.size">size</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 97 <span class="identifier">size_type</span> <a class="link" href="match_results.html#boost_regex.match_results.max_size">max_size</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 98 <span class="keyword">bool</span> <a class="link" href="match_results.html#boost_regex.match_results.empty">empty</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 99 <span class="comment">// element access:</span> 100 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 101 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 102 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 103 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 104 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 105 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.length">length</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 106 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 107 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 108 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 109 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 110 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 111 <span class="identifier">difference_type</span> <a class="link" href="match_results.html#boost_regex.match_results.position">position</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 112 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 113 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 114 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 115 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 116 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 117 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 118 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 119 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.str">str</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 120 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 121 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 122 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 123 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 124 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 125 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 126 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 127 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.subscript">operator[]</a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 128 129 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.prefix">prefix</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 130 131 <span class="identifier">const_reference</span> <a class="link" href="match_results.html#boost_regex.match_results.suffix">suffix</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 132 <span class="identifier">const_iterator</span> <a class="link" href="match_results.html#boost_regex.match_results.begin">begin</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 133 <span class="identifier">const_iterator</span> <a class="link" href="match_results.html#boost_regex.match_results.end">end</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 134 <span class="comment">// format:</span> 135 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> 136 <span class="identifier">OutputIterator</span> <a class="link" href="match_results.html#boost_regex.match_results.format">format</a><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span> 137 <span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> 138 <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 139 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> 140 <span class="identifier">string_type</span> <a class="link" href="match_results.html#boost_regex.match_results.format2">format</a><span class="special">(</span><span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> 141 <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 142 143 <span class="identifier">allocator_type</span> <a class="link" href="match_results.html#boost_regex.match_results.get_allocator">get_allocator</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 144 <span class="keyword">void</span> <a class="link" href="match_results.html#boost_regex.match_results.swap">swap</a><span class="special">(</span><span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span> 145 146<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_REGEX_MATCH_EXTRA</span> 147 <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">::</span><span class="identifier">capture_sequence_type</span> <span class="identifier">capture_sequence_type</span><span class="special">;</span> 148 <span class="keyword">const</span> <span class="identifier">capture_sequence_type</span><span class="special">&</span> <a class="link" href="match_results.html#boost_regex.match_results.captures">captures</a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 149<span class="preprocessor">#endif</span> 150 151<span class="special">};</span> 152 153<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 154<span class="keyword">bool</span> <a class="link" href="match_results.html#boost_regex.match_results.op_eq">operator ==</a> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 155 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 156<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 157<span class="keyword">bool</span> <a class="link" href="match_results.html#boost_regex.match_results.op_ne">operator !=</a> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 158 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 159 160<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 161<span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">>&</span> 162 <a class="link" href="match_results.html#boost_regex.match_results.op_stream">operator <<</a> <span class="special">(</span><span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">>&</span> <span class="identifier">os</span><span class="special">,</span> 163 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">);</span> 164 165<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 166<span class="keyword">void</span> <a class="link" href="match_results.html#boost_regex.match_results.op_swap">swap</a><span class="special">(</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 167 <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 168</pre> 169<h5> 170<a name="boost_regex.ref.match_results.h1"></a> 171 <span class="phrase"><a name="boost_regex.ref.match_results.description"></a></span><a class="link" href="match_results.html#boost_regex.ref.match_results.description">Description</a> 172 </h5> 173<p> 174 In all <code class="computeroutput"><span class="identifier">match_results</span></code> constructors, 175 a copy of the Allocator argument is used for any memory allocation performed 176 by the constructor or member functions during the lifetime of the object. 177 </p> 178<a name="boost_regex.match_results.construct"></a><pre class="programlisting"><span class="identifier">match_results</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Allocator</span><span class="special">&</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">Allocator</span><span class="special">());</span> 179</pre> 180<p> 181 <span class="bold"><strong>Effects</strong></span>: Constructs an object of class 182 <code class="computeroutput"><span class="identifier">match_results</span></code>. The postconditions 183 of this function are indicated in the table: 184 </p> 185<div class="informaltable"><table class="table"> 186<colgroup> 187<col> 188<col> 189</colgroup> 190<thead><tr> 191<th> 192 <p> 193 Element 194 </p> 195 </th> 196<th> 197 <p> 198 Value 199 </p> 200 </th> 201</tr></thead> 202<tbody> 203<tr> 204<td> 205 <p> 206 empty() 207 </p> 208 </td> 209<td> 210 <p> 211 true 212 </p> 213 </td> 214</tr> 215<tr> 216<td> 217 <p> 218 size() 219 </p> 220 </td> 221<td> 222 <p> 223 0 224 </p> 225 </td> 226</tr> 227<tr> 228<td> 229 <p> 230 str() 231 </p> 232 </td> 233<td> 234 <p> 235 basic_string<charT>() 236 </p> 237 </td> 238</tr> 239</tbody> 240</table></div> 241<a name="boost_regex.match_results.copy_construct"></a><pre class="programlisting"><span class="identifier">match_results</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span> 242</pre> 243<p> 244 <span class="bold"><strong>Effects</strong></span>: Constructs an object of class match_results, 245 as a copy of m. 246 </p> 247<a name="boost_regex.match_results.assign"></a><pre class="programlisting"><span class="identifier">match_results</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">m</span><span class="special">);</span> 248</pre> 249<p> 250 <span class="bold"><strong>Effects</strong></span>: Assigns m to *this. The postconditions 251 of this function are indicated in the table: 252 </p> 253<div class="informaltable"><table class="table"> 254<colgroup> 255<col> 256<col> 257</colgroup> 258<thead><tr> 259<th> 260 <p> 261 Element 262 </p> 263 </th> 264<th> 265 <p> 266 Value 267 </p> 268 </th> 269</tr></thead> 270<tbody> 271<tr> 272<td> 273 <p> 274 empty() 275 </p> 276 </td> 277<td> 278 <p> 279 m.empty(). 280 </p> 281 </td> 282</tr> 283<tr> 284<td> 285 <p> 286 size() 287 </p> 288 </td> 289<td> 290 <p> 291 m.size(). 292 </p> 293 </td> 294</tr> 295<tr> 296<td> 297 <p> 298 str(n) 299 </p> 300 </td> 301<td> 302 <p> 303 m.str(n) for all integers n < m.size(). 304 </p> 305 </td> 306</tr> 307<tr> 308<td> 309 <p> 310 prefix() 311 </p> 312 </td> 313<td> 314 <p> 315 m.prefix(). 316 </p> 317 </td> 318</tr> 319<tr> 320<td> 321 <p> 322 suffix() 323 </p> 324 </td> 325<td> 326 <p> 327 m.suffix(). 328 </p> 329 </td> 330</tr> 331<tr> 332<td> 333 <p> 334 (*this)[n] 335 </p> 336 </td> 337<td> 338 <p> 339 m[n] for all integers n < m.size(). 340 </p> 341 </td> 342</tr> 343<tr> 344<td> 345 <p> 346 length(n) 347 </p> 348 </td> 349<td> 350 <p> 351 m.length(n) for all integers n < m.size(). 352 </p> 353 </td> 354</tr> 355<tr> 356<td> 357 <p> 358 position(n) 359 </p> 360 </td> 361<td> 362 <p> 363 m.position(n) for all integers n < m.size(). 364 </p> 365 </td> 366</tr> 367</tbody> 368</table></div> 369<a name="boost_regex.match_results.size"></a><pre class="programlisting"><span class="identifier">size_type</span> <span class="identifier">size</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 370</pre> 371<p> 372 <span class="bold"><strong>Effects</strong></span>: Returns the number of <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> elements stored in *this; 373 that is the number of marked sub-expressions in the regular expression that 374 was matched plus one. 375 </p> 376<a name="boost_regex.match_results.max_size"></a><pre class="programlisting"><span class="identifier">size_type</span> <span class="identifier">max_size</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 377</pre> 378<p> 379 <span class="bold"><strong>Effects</strong></span>: Returns the maximum number of 380 <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 381 elements that can be stored in *this. 382 </p> 383<a name="boost_regex.match_results.empty"></a><pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 384</pre> 385<p> 386 <span class="bold"><strong>Effects</strong></span>: Returns size() == 0. 387 </p> 388<a name="boost_regex.match_results.length"></a><pre class="programlisting"><span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 389<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 390<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 391<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 392<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 393<span class="identifier">difference_type</span> <span class="identifier">length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&)</span><span class="keyword">const</span><span class="special">;</span> 394</pre> 395<p> 396 <span class="bold"><strong>Requires</strong></span>: that the match_results object 397 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 398 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 399 and that the underlying iterators have not been subsequently invalidated. 400 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 401 was not initialized. 402 </p> 403<p> 404 <span class="bold"><strong>Effects</strong></span>: Returns the length of sub-expression 405 <span class="emphasis"><em>sub</em></span>, that is to say: <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">sub</span><span class="special">].</span><span class="identifier">length</span><span class="special">()</span></code>. 406 </p> 407<p> 408 The overloads that accept a string refer to a named sub-expression <span class="emphasis"><em>n</em></span>. 409 In the event that there is no such named sub-expression then returns zero. 410 </p> 411<p> 412 The template overloads of this function, allow the string and/or character 413 type to be different from the character type of the underlying sequence and/or 414 regular expression: in this case the characters will be widened to the underlying 415 character type of the original regular expression. A compiler error will 416 occur if the argument passes a wider character type than the underlying sequence. 417 These overloads allow a normal narrow character C string literal to be used 418 as an argument, even when the underlying character type of the expression 419 being matched may be something more exotic such as a Unicode character type. 420 </p> 421<a name="boost_regex.match_results.position"></a><pre class="programlisting"><span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 422<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 423<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 424<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 425<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 426<span class="identifier">difference_type</span> <span class="identifier">position</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&)</span><span class="keyword">const</span><span class="special">;</span> 427</pre> 428<p> 429 <span class="bold"><strong>Requires</strong></span>: that the match_results object 430 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 431 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 432 and that the underlying iterators have not been subsequently invalidated. 433 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 434 was not initialized. 435 </p> 436<p> 437 <span class="bold"><strong>Effects</strong></span>: Returns the starting location of 438 sub-expression <span class="emphasis"><em>sub</em></span>, or -1 if <span class="emphasis"><em>sub</em></span> 439 was not matched. Note that if this represents a partial match , then <code class="computeroutput"><span class="identifier">position</span><span class="special">()</span></code> 440 will return the location of the partial match even though <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="number">0</span><span class="special">].</span><span class="identifier">matched</span></code> 441 is false. 442 </p> 443<p> 444 The overloads that accept a string refer to a named sub-expression <span class="emphasis"><em>n</em></span>. 445 In the event that there is no such named sub-expression then returns -1. 446 </p> 447<p> 448 The template overloads of this function, allow the string and/or character 449 type to be different from the character type of the underlying sequence and/or 450 regular expression: in this case the characters will be widened to the underlying 451 character type of the original regular expression. A compiler error will 452 occur if the argument passes a wider character type than the underlying sequence. 453 These overloads allow a normal narrow character C string literal to be used 454 as an argument, even when the underlying character type of the expression 455 being matched may be something more exotic such as a Unicode character type. 456 </p> 457<a name="boost_regex.match_results.str"></a><pre class="programlisting"><span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 458<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 459<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 460<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 461<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 462<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 463<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 464<span class="identifier">string_type</span> <span class="identifier">str</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">sub</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 465</pre> 466<p> 467 <span class="bold"><strong>Requires</strong></span>: that the match_results object 468 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 469 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 470 and that the underlying iterators have not been subsequently invalidated. 471 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 472 was not initialized. 473 </p> 474<p> 475 <span class="bold"><strong>Effects</strong></span>: Returns sub-expression <span class="emphasis"><em>sub</em></span> 476 as a string: <code class="computeroutput"><span class="identifier">string_type</span><span class="special">((*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">sub</span><span class="special">])</span></code>. 477 </p> 478<p> 479 The overloads that accept a string, return the string that matched the named 480 sub-expression <span class="emphasis"><em>n</em></span>. In the event that there is no such 481 named sub-expression then returns an empty string. 482 </p> 483<p> 484 The template overloads of this function, allow the string and/or character 485 type to be different from the character type of the underlying sequence and/or 486 regular expression: in this case the characters will be widened to the underlying 487 character type of the original regular expression. A compiler error will 488 occur if the argument passes a wider character type than the underlying sequence. 489 These overloads allow a normal narrow character C string literal to be used 490 as an argument, even when the underlying character type of the expression 491 being matched may be something more exotic such as a Unicode character type. 492 </p> 493<a name="boost_regex.match_results.subscript"></a><pre class="programlisting"><span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 494<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">char_type</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 495<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 496<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 497<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span> 498<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 499<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">></span> 500<span class="identifier">const_reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">A</span><span class="special">>&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 501</pre> 502<p> 503 <span class="bold"><strong>Requires</strong></span>: that the match_results object 504 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 505 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 506 and that the underlying iterators have not been subsequently invalidated. 507 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 508 was not initialized. 509 </p> 510<p> 511 <span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 512 object representing the character sequence that matched marked sub-expression 513 <span class="emphasis"><em>n</em></span>. If <code class="computeroutput"><span class="identifier">n</span> <span class="special">==</span> <span class="number">0</span></code> then returns 514 a reference to a <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> object representing the 515 character sequence that matched the whole regular expression. If <span class="emphasis"><em>n</em></span> 516 is out of range, or if <span class="emphasis"><em>n</em></span> is an unmatched sub-expression, 517 then returns a <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 518 object whose matched member is false. 519 </p> 520<p> 521 The overloads that accept a string, return a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> object representing the 522 character sequence that matched the named sub-expression <span class="emphasis"><em>n</em></span>. 523 In the event that there is no such named sub-expression then returns a <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 524 object whose matched member is false. 525 </p> 526<p> 527 The template overloads of this function, allow the string and/or character 528 type to be different from the character type of the underlying sequence and/or 529 regular expression: in this case the characters will be widened to the underlying 530 character type of the original regular expression. A compiler error will 531 occur if the argument passes a wider character type than the underlying sequence. 532 These overloads allow a normal narrow character C string literal to be used 533 as an argument, even when the underlying character type of the expression 534 being matched may be something more exotic such as a Unicode character type. 535 </p> 536<a name="boost_regex.match_results.prefix"></a><pre class="programlisting"><span class="identifier">const_reference</span> <span class="identifier">prefix</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 537</pre> 538<p> 539 <span class="bold"><strong>Requires</strong></span>: that the match_results object 540 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 541 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 542 and that the underlying iterators have not been subsequently invalidated. 543 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 544 was not initialized. 545 </p> 546<p> 547 <span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 548 object representing the character sequence from the start of the string being 549 matched or searched, to the start of the match found. 550 </p> 551<a name="boost_regex.match_results.suffix"></a><pre class="programlisting"><span class="identifier">const_reference</span> <span class="identifier">suffix</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 552</pre> 553<p> 554 <span class="bold"><strong>Requires</strong></span>: that the match_results object 555 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 556 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 557 and that the underlying iterators have not been subsequently invalidated. 558 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 559 was not initialized. 560 </p> 561<p> 562 <span class="bold"><strong>Effects</strong></span>: Returns a reference to the <a class="link" href="sub_match.html" title="sub_match"><code class="computeroutput"><span class="identifier">sub_match</span></code></a> 563 object representing the character sequence from the end of the match found 564 to the end of the string being matched or searched. 565 </p> 566<a name="boost_regex.match_results.begin"></a><pre class="programlisting"><span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 567</pre> 568<p> 569 <span class="bold"><strong>Effects</strong></span>: Returns a starting iterator that 570 enumerates over all the marked sub-expression matches stored in *this. 571 </p> 572<a name="boost_regex.match_results.end"></a><pre class="programlisting"><span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 573</pre> 574<p> 575 <span class="bold"><strong>Effects</strong></span>: Returns a terminating iterator 576 that enumerates over all the marked sub-expression matches stored in *this. 577 </p> 578<a name="boost_regex.match_results_format"></a><a name="boost_regex.match_results.format"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> 579<span class="identifier">OutputIterator</span> <span class="identifier">format</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span> 580 <span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> 581 <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">);</span> 582</pre> 583<p> 584 <span class="bold"><strong>Requires</strong></span>: The type <code class="computeroutput"><span class="identifier">OutputIterator</span></code> 585 conforms to the Output Iterator requirements (C++ std 24.1.2). 586 </p> 587<p> 588 The type <code class="computeroutput"><span class="identifier">Formatter</span></code> must be 589 either a pointer to a null-terminated string of type <code class="computeroutput"><span class="identifier">char_type</span><span class="special">[]</span></code>, or be a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s 590 (for example <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">></span></code>) 591 or be a unary, binary or ternary functor that computes the replacement string 592 from a function call: either <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code> 593 which must return a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s 594 to be used as the replacement text, or either <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> 595 <span class="identifier">out</span><span class="special">)</span></code> 596 or <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">out</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">)</span></code>, both of which write the replacement text 597 to <code class="computeroutput"><span class="special">*</span><span class="identifier">out</span></code>, 598 and then return the new OutputIterator position. Note that if the formatter 599 is a functor, then it is <span class="emphasis"><em>passed by value</em></span>: users that 600 want to pass function objects with internal state might want to use <a href="../../../../../../doc/html/ref.html" target="_top">Boost.Ref</a> to wrap the object 601 so that it's passed by reference. 602 </p> 603<p> 604 <span class="bold"><strong>Requires</strong></span>: that the match_results object 605 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 606 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 607 and that the underlying iterators have not been subsequently invalidated. 608 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 609 was not initialized. 610 </p> 611<p> 612 <span class="bold"><strong>Effects</strong></span>: If <code class="computeroutput"><span class="identifier">fmt</span></code> 613 is either a null-terminated string, or a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s, 614 then copies the character sequence <code class="computeroutput"><span class="special">[</span><span class="identifier">fmt</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">fmt</span><span class="special">.</span><span class="identifier">end</span><span class="special">())</span></code> 615 to <code class="computeroutput"><span class="identifier">OutputIterator</span></code> <span class="emphasis"><em>out</em></span>. 616 For each format specifier or escape sequence in <span class="emphasis"><em>fmt</em></span>, 617 replace that sequence with either the character(s) it represents, or the 618 sequence of characters within <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> to which it refers. The bitmasks specified 619 in flags determines what format specifiers or escape sequences are recognized, 620 by default this is the format used by ECMA-262, ECMAScript Language Specification, 621 Chapter 15 part 5.4.11 String.prototype.replace. 622 </p> 623<p> 624 If <code class="computeroutput"><span class="identifier">fmt</span></code> is a function object, 625 then depending on the number of arguments the function object accepts, it 626 will either: 627 </p> 628<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 629<li class="listitem"> 630 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code> 631 and copy the string returned to <code class="computeroutput"><span class="identifier">OutputIterator</span></code> 632 <span class="emphasis"><em>out</em></span>. 633 </li> 634<li class="listitem"> 635 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">out</span><span class="special">)</span></code>. 636 </li> 637<li class="listitem"> 638 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">out</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">)</span></code>. 639 </li> 640</ul></div> 641<p> 642 In all cases the new position of the <code class="computeroutput"><span class="identifier">OutputIterator</span></code> 643 is returned. 644 </p> 645<p> 646 See the <a class="link" href="../format.html" title="Search and Replace Format String Syntax">format syntax guide for more information</a>. 647 </p> 648<p> 649 <span class="bold"><strong>Returns</strong></span>: out. 650 </p> 651<a name="boost_regex.match_results.format2"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> 652<span class="identifier">string_type</span> <span class="identifier">format</span><span class="special">(</span><span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> 653 <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">);</span> 654</pre> 655<p> 656 <span class="bold"><strong>Requires</strong></span> The type <code class="computeroutput"><span class="identifier">Formatter</span></code> 657 must be either a pointer to a null-terminated string of type <code class="computeroutput"><span class="identifier">char_type</span><span class="special">[]</span></code>, 658 or be a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s 659 (for example <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">char_type</span><span class="special">></span></code>) 660 or be a unary, binary or ternary functor that computes the replacement string 661 from a function call: either <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code> 662 which must return a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s 663 to be used as the replacement text, or either <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> 664 <span class="identifier">out</span><span class="special">)</span></code> 665 or <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">out</span><span class="special">,</span> <span class="identifier">flags</span><span class="special">)</span></code>, both of which write the replacement text 666 to <code class="computeroutput"><span class="special">*</span><span class="identifier">out</span></code>, 667 and then return the new OutputIterator position. 668 </p> 669<p> 670 <span class="bold"><strong>Requires</strong></span>: that the match_results object 671 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 672 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 673 and that the underlying iterators have not been subsequently invalidated. 674 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 675 was not initialized. 676 </p> 677<p> 678 <span class="bold"><strong>Effects</strong></span>: If <code class="computeroutput"><span class="identifier">fmt</span></code> 679 is either a null-terminated string, or a container of <code class="computeroutput"><span class="identifier">char_type</span></code>'s, 680 then copies the string <span class="emphasis"><em>fmt</em></span>: For each format specifier 681 or escape sequence in <span class="emphasis"><em>fmt</em></span>, replace that sequence with 682 either the character(s) it represents, or the sequence of characters within 683 <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> 684 to which it refers. The bitmasks specified in flags determines what format 685 specifiers or escape sequences are recognized, by default this is the format 686 used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 687 String.prototype.replace. 688 </p> 689<p> 690 If <code class="computeroutput"><span class="identifier">fmt</span></code> is a function object, 691 then depending on the number of arguments the function object accepts, it 692 will either: 693 </p> 694<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 695<li class="listitem"> 696 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code> 697 and return the result. 698 </li> 699<li class="listitem"> 700 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">output</span><span class="special">-</span><span class="identifier">iterator</span><span class="special">)</span></code>, 701 where <code class="computeroutput"><span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">output</span><span class="special">-</span><span class="identifier">iterator</span></code> is an unspecified OutputIterator 702 type used to copy the output to the string result. 703 </li> 704<li class="listitem"> 705 Call <code class="computeroutput"><span class="identifier">fmt</span><span class="special">(*</span><span class="keyword">this</span><span class="special">,</span> <span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">output</span><span class="special">-</span><span class="identifier">iterator</span><span class="special">,</span> 706 <span class="identifier">flags</span><span class="special">)</span></code>, 707 where <code class="computeroutput"><span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">output</span><span class="special">-</span><span class="identifier">iterator</span></code> is an unspecified OutputIterator 708 type used to copy the output to the string result. 709 </li> 710</ul></div> 711<p> 712 See the <a class="link" href="../format.html" title="Search and Replace Format String Syntax">format syntax guide for more information</a>. 713 </p> 714<a name="boost_regex.match_results.get_allocator"></a><pre class="programlisting"><span class="identifier">allocator_type</span> <span class="identifier">get_allocator</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> 715</pre> 716<p> 717 <span class="bold"><strong>Effects</strong></span>: Returns a copy of the Allocator 718 that was passed to the object's constructor. 719 </p> 720<a name="boost_regex.match_results.swap"></a><pre class="programlisting"><span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">match_results</span><span class="special">&</span> <span class="identifier">that</span><span class="special">);</span> 721</pre> 722<p> 723 <span class="bold"><strong>Effects</strong></span>: Swaps the contents of the two sequences. 724 </p> 725<p> 726 <span class="bold"><strong>Postcondition</strong></span>: *this contains the sequence 727 of matched sub-expressions that were in that, that contains the sequence 728 of matched sub-expressions that were in *this. 729 </p> 730<p> 731 <span class="bold"><strong>Complexity</strong></span>: constant time. 732 </p> 733<a name="boost_regex.match_results.capture_type"></a><pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">::</span><span class="identifier">capture_sequence_type</span> <span class="identifier">capture_sequence_type</span><span class="special">;</span> 734</pre> 735<p> 736 Defines an implementation-specific type that satisfies the requirements of 737 a standard library Sequence (21.1.1 including the optional Table 68 operations), 738 whose value_type is a <code class="computeroutput"><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span></code>. This type happens to be <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">sub_match</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">></span> <span class="special">></span></code>, 739 but you shouldn't actually rely on that. 740 </p> 741<a name="boost_regex.match_results.captures"></a><pre class="programlisting"><span class="keyword">const</span> <span class="identifier">capture_sequence_type</span><span class="special">&</span> <span class="identifier">captures</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span> 742</pre> 743<p> 744 <span class="bold"><strong>Requires</strong></span>: that the match_results object 745 has been initialized as a result of a successful call to <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a> or <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a> or was returned from 746 a <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a>, 747 and that the underlying iterators have not been subsequently invalidated. 748 Will raise a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">logic_error</span></code> if the match_results object 749 was not initialized. 750 </p> 751<p> 752 <span class="bold"><strong>Effects</strong></span>: returns a sequence containing all 753 the captures obtained for sub-expression i. 754 </p> 755<p> 756 <span class="bold"><strong>Returns</strong></span>: <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)[</span><span class="identifier">i</span><span class="special">].</span><span class="identifier">captures</span><span class="special">();</span></code> 757 </p> 758<p> 759 <span class="bold"><strong>Preconditions</strong></span>: the library must be built 760 and used with BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag 761 match_extra to the regex matching functions ( <a class="link" href="regex_match.html" title="regex_match"><code class="computeroutput"><span class="identifier">regex_match</span></code></a>, <a class="link" href="regex_search.html" title="regex_search"><code class="computeroutput"><span class="identifier">regex_search</span></code></a>, <a class="link" href="regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a class="link" href="regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a>) in order for 762 this member function to be defined and return useful information. 763 </p> 764<p> 765 <span class="bold"><strong>Rationale</strong></span>: Enabling this feature has several 766 consequences: 767 </p> 768<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 769<li class="listitem"> 770 sub_match occupies more memory resulting in complex expressions running 771 out of memory or stack space more quickly during matching. 772 </li> 773<li class="listitem"> 774 The matching algorithms are less efficient at handling some features 775 (independent sub-expressions for example), even when match_extra is not 776 used. 777 </li> 778<li class="listitem"> 779 The matching algorithms are much less efficient (i.e. slower), when match_extra 780 is used. Mostly this is down to the extra memory allocations that have 781 to take place. 782 </li> 783</ul></div> 784<a name="boost_regex.match_results.op_eq"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 785<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 786 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 787</pre> 788<p> 789 <span class="bold"><strong>Effects</strong></span>: Compares the two sequences for 790 equality. 791 </p> 792<a name="boost_regex.match_results.op_ne"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 793<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 794 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 795</pre> 796<p> 797 <span class="bold"><strong>Effects</strong></span>: Compares the two sequences for 798 inequality. 799 </p> 800<a name="boost_regex.match_results.op_stream"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 801<span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">>&</span> 802 <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">>&</span> <span class="identifier">os</span><span class="special">,</span> 803 <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">);</span> 804</pre> 805<p> 806 <span class="bold"><strong>Effects</strong></span>: Writes the contents of <span class="emphasis"><em>m</em></span> 807 to the stream <span class="emphasis"><em>os</em></span> as if by calling <code class="computeroutput"><span class="identifier">os</span> 808 <span class="special"><<</span> <span class="identifier">m</span><span class="special">.</span><span class="identifier">str</span><span class="special">()</span></code>; 809 Returns <span class="emphasis"><em>os</em></span>. 810 </p> 811<a name="boost_regex.match_results.op_swap"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span> 812<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m1</span><span class="special">,</span> 813 <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">BidirectionalIterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m2</span><span class="special">);</span> 814</pre> 815<p> 816 <span class="bold"><strong>Effects</strong></span>: Swaps the contents of the two sequences. 817 </p> 818</div> 819<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 820<td align="left"></td> 821<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p> 822 Distributed under the Boost Software License, Version 1.0. (See accompanying 823 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 824 </p> 825</div></td> 826</tr></table> 827<hr> 828<div class="spirit-nav"> 829<a accesskey="p" href="basic_regex.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sub_match.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 830</div> 831</body> 832</html> 833