From b0a325cf65fda3a29e19942f1d2cb0846a1d9929 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 26 Aug 2004 10:41:49 +0000 Subject: [PATCH] Fix: re-used match_results structure didn't set size correctly. [SVN r24744] --- include/boost/regex/v4/match_results.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/regex/v4/match_results.hpp b/include/boost/regex/v4/match_results.hpp index 3139a857..fdbc3337 100644 --- a/include/boost/regex/v4/match_results.hpp +++ b/include/boost/regex/v4/match_results.hpp @@ -73,7 +73,7 @@ public: // size: size_type size() const - { return m_subs.size() - 2; } + { return (m_subs.size() >= 2) ? m_subs.size() - 2 : 0; } size_type max_size() const { return m_subs.max_size(); } bool empty() const @@ -134,7 +134,7 @@ public: } const_iterator begin() const { - return (m_subs.size() > 2) ? (m_subs.begin() + 2) : m_subs.end(); + return (m_subs.size() >= 2) ? (m_subs.begin() + 2) : m_subs.end(); } const_iterator end() const { @@ -218,7 +218,7 @@ public: size_type len = m_subs.size(); if(len > n + 2) { - m_subs.erase(m_subs.begin()+n+2); + m_subs.erase(m_subs.begin()+n+2, m_subs.end()); std::fill(m_subs.begin(), m_subs.end(), v); } else