From 328e0b5561f10d2e3d540954682a752be9181638 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 20 Jan 2001 12:57:47 +0000 Subject: [PATCH] regex: fixes for Como in strict mode [SVN r8655] --- demo/regress/tests.cpp | 11 ++++++----- include/boost/re_detail/regex_config.hpp | 3 ++- include/boost/regex.hpp | 10 ++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/demo/regress/tests.cpp b/demo/regress/tests.cpp index 906fadb3..e61288a3 100644 --- a/demo/regress/tests.cpp +++ b/demo/regress/tests.cpp @@ -202,7 +202,7 @@ bool grep_test_predicate::operator()(const boost::match_results template void cpp_tests(const reg_expression& e, bool recurse = true) { - typedef A allocator_type; + typedef typename reg_expression::allocator_type allocator_type; if(flags[4] & REG_MERGE) { // @@ -250,9 +250,9 @@ void cpp_tests(const reg_expression& e, bool recurse = true) if(!recurse) { std::basic_string s(search_text.begin(), search_text.end()); - grep_test_predicate::const_iterator, reg_expression::allocator_type> oi2(s.begin(), s.end()); + grep_test_predicate::const_iterator, allocator_type> oi2(s.begin(), s.end()); regex_grep(oi2, s, e, flags[3]); - grep_test_predicate::allocator_type> oi3(s.c_str(), s.c_str()+s.size()); + grep_test_predicate oi3(s.c_str(), s.c_str()+s.size()); regex_grep(oi3, s.c_str(), e, flags[3]); } #endif @@ -260,7 +260,7 @@ void cpp_tests(const reg_expression& e, bool recurse = true) else { // try to find match - match_results< debug_iterator, reg_expression::allocator_type> m; + match_results< debug_iterator, allocator_type> m; debug_iterator x(search_text.begin(), search_text.begin(), search_text.end()); debug_iterator y(search_text.end(), search_text.begin(), search_text.end()); if(regex_search(x, y, m, e, flags[3])) @@ -371,7 +371,7 @@ void cpp_tests(const reg_expression& e, bool recurse = true) // match expected on whole string, so all versions // of regex_match should also succeed: // - match_results< debug_iterator, reg_expression::allocator_type> m1; + match_results< debug_iterator, allocator_type> m1; debug_iterator x1(search_text.begin(), search_text.begin(), search_text.end()); debug_iterator y1(search_text.end(), search_text.begin(), search_text.end()); if(regex_match(x1, y1, m1, e, flags[3])) @@ -747,3 +747,4 @@ void reset_error() + diff --git a/include/boost/re_detail/regex_config.hpp b/include/boost/re_detail/regex_config.hpp index 3082498c..b4adf575 100644 --- a/include/boost/re_detail/regex_config.hpp +++ b/include/boost/re_detail/regex_config.hpp @@ -828,7 +828,7 @@ public: pointer BOOST_RE_CALL address(reference x) const { return &x; } const_pointer BOOST_RE_CALL address(const_reference x) const { return &x; } - static size_type BOOST_RE_CALL max_size() { return -1; } + static size_type BOOST_RE_CALL max_size() { return (size_type)-1; } static void BOOST_RE_CALL construct(pointer p, const T& val) { jm_construct(p, val); } void BOOST_RE_CALL destroy(pointer p) { jm_destroy(p); } @@ -1272,5 +1272,6 @@ namespace std{ + diff --git a/include/boost/regex.hpp b/include/boost/regex.hpp index 00e8bfbb..7cb026bf 100644 --- a/include/boost/regex.hpp +++ b/include/boost/regex.hpp @@ -524,8 +524,8 @@ public: : data(a), pkmp(0) { set_expression(p, f); } template - reg_expression(I first, I last, flag_type f = regbase::normal, const Allocator& a = Allocator()) - : data(a), pkmp(0) + reg_expression(I first, I last, flag_type f = regbase::normal, const Allocator& al = Allocator()) + : data(al), pkmp(0) { size_type len = last-first; scoped_array a(new charT[len]); @@ -545,7 +545,7 @@ public: const std::basic_string& s, flag_type f = regbase::normal) { - set_expression(p.c_str(), p.c_str() + p.size(), f | regbase::use_except); + set_expression(s.c_str(), s.c_str() + s.size(), f | regbase::use_except); return *this; } @@ -1395,7 +1395,7 @@ match_results::match_results(const match_resultsref); throw; } } @@ -1474,6 +1474,8 @@ typedef match_results wcmatch; + +