Updated to get xpressive tests to run correctly, and to use regex_iterators for searching.

[SVN r31018]
This commit is contained in:
John Maddock
2005-09-18 09:25:14 +00:00
parent 5973f3eb07
commit badb291912
4 changed files with 67 additions and 4 deletions

View File

@ -53,6 +53,13 @@ double time_match(const std::string& re, const std::string& text, bool icase)
bool dummy_grep_proc(const boost::smatch&)
{ return true; }
struct noop
{
void operator()( boost::smatch const & ) const
{
}
};
double time_find_all(const std::string& re, const std::string& text, bool icase)
{
boost::regex e(re, (icase ? boost::regex::perl | boost::regex::icase : boost::regex::perl));
@ -67,7 +74,9 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
tim.restart();
for(counter = 0; counter < iter; ++counter)
{
boost::regex_grep(&dummy_grep_proc, text, e);
boost::sregex_iterator begin( text.begin(), text.end(), e ), end;
std::for_each( begin, end, noop() );
//boost::regex_grep(&dummy_grep_proc, text, e);
}
result = tim.elapsed();
iter *= 2;