Allow match_results::position() to return a valid value for partial matches.

[SVN r34324]
This commit is contained in:
John Maddock
2006-06-17 12:48:03 +00:00
parent c666793a92
commit 4f90cd5c91
5 changed files with 21 additions and 13 deletions

View File

@ -26,9 +26,12 @@
<p></p>
<P>Boost 1.34</P>
<UL>
<LI>
Fix for non-greedy repeats and partial matches not working correctly in some cases.
</LI>
<LI>
Fix for non-greedy repeats and partial matches not working correctly in some
cases.
<LI>
Changed match_results::position() to return a valid result when *this
represents a partial match.</LI>
</UL>
<P>Boost 1.33.1</P>
<UL>
@ -159,7 +162,7 @@
<HR>
<P></P>
<p>Revised&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
28 June 2004&nbsp;
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
@ -169,4 +172,3 @@
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -300,7 +300,9 @@ difference_type position(unsigned int sub = 0)const;
</pre>
<b></b>
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
or -1 if <EM>sub</EM> was not matched <code>.</code></p>
or -1 if <EM>sub</EM> was not matched.&nbsp; Note that if this represents a <A href="partial_matches.html">
partial match</A> , then <code>position()</code> will return the location of
the partial match even though <code>(*this)[0].matched</code> is <EM>false</EM>.</p>
<pre><A name=m6></A>
string_type str(int sub = 0)const;
</pre>

View File

@ -26,9 +26,12 @@
<p></p>
<P>Boost 1.34</P>
<UL>
<LI>
Fix for non-greedy repeats and partial matches not working correctly in some cases.
</LI>
<LI>
Fix for non-greedy repeats and partial matches not working correctly in some
cases.
<LI>
Changed match_results::position() to return a valid result when *this
represents a partial match.</LI>
</UL>
<P>Boost 1.33.1</P>
<UL>
@ -159,7 +162,7 @@
<HR>
<P></P>
<p>Revised&nbsp;
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
28 June 2004&nbsp;
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
@ -169,4 +172,3 @@
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
</html>

View File

@ -300,7 +300,9 @@ difference_type position(unsigned int sub = 0)const;
</pre>
<b></b>
<p><b>Effects:</b> Returns the starting location of sub-expression <EM>sub</EM>,
or -1 if <EM>sub</EM> was not matched <code>.</code></p>
or -1 if <EM>sub</EM> was not matched.&nbsp; Note that if this represents a <A href="partial_matches.html">
partial match</A> , then <code>position()</code> will return the location of
the partial match even though <code>(*this)[0].matched</code> is <EM>false</EM>.</p>
<pre><A name=m6></A>
string_type str(int sub = 0)const;
</pre>

View File

@ -94,7 +94,7 @@ public:
if(sub < m_subs.size())
{
const sub_match<BidiIterator>& s = m_subs[sub];
if(s.matched)
if(s.matched || (sub == 2))
{
return ::boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
}