Fix begin() and end() members and add tests.

Fixes #6346.

[SVN r79340]
This commit is contained in:
John Maddock
2012-07-07 18:36:25 +00:00
parent 3bfba1a7cf
commit ab6b0d9971
4 changed files with 11 additions and 3 deletions

View File

@ -19,7 +19,7 @@ All issues including closed ones can be viewed [@https://svn.boost.org/trac/boos
Fixed issues:
[@https://svn.boost.org/trac/boost/ticket/589 #589], [@https://svn.boost.org/trac/boost/ticket/7084 #7084],
[@https://svn.boost.org/trac/boost/ticket/7032 #7032].
[@https://svn.boost.org/trac/boost/ticket/7032 #7032], [@https://svn.boost.org/trac/boost/ticket/6346 #6346].
[h4 Boost-1.50]

View File

@ -243,11 +243,11 @@ public:
// begin, end:
const_iterator BOOST_REGEX_CALL begin()const
{
return (!this->m_status ? 0 : this->m_expression);
return (this->m_status ? 0 : this->m_expression);
}
const_iterator BOOST_REGEX_CALL end()const
{
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
return (this->m_status ? 0 : this->m_expression + this->m_expression_len);
}
flag_type BOOST_REGEX_CALL flags()const
{

View File

@ -48,6 +48,10 @@ void test_empty(boost::basic_regex<charT, traits>& r)
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT);
}
if(r.begin() != r.end())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
}
}
template<class charT, class traits>

View File

@ -482,6 +482,10 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), charT);
}
if(expression != std::basic_string<charT>(r.begin(), r.end()))
{
BOOST_REGEX_TEST_ERROR("Stored expression string was incorrect", charT);
}
test_simple_search(r);
test_regex_iterator(r);
test_regex_token_iterator(r);