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

@ -13,6 +13,7 @@
#ifdef BOOST_HAS_XPRESSIVE
#include <cassert>
#include <iostream>
#include <boost/timer.hpp>
#include <boost/xpressive/xpressive.hpp>
@ -21,6 +22,7 @@ namespace dxpr
double time_match(const std::string& re, const std::string& text, bool icase)
{
try{
boost::xpressive::sregex e;
e = (icase ?
boost::xpressive::sregex(boost::xpressive::sregex::compile(re))
@ -56,6 +58,12 @@ double time_match(const std::string& re, const std::string& text, bool icase)
result = (std::min)(run, result);
}
return result / iter;
}
catch(const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
return -1;
}
}
struct noop
@ -67,6 +75,7 @@ struct noop
double time_find_all(const std::string& re, const std::string& text, bool icase)
{
try{
boost::xpressive::sregex e;
e = (icase ?
boost::xpressive::sregex(boost::xpressive::sregex::compile(re))
@ -106,6 +115,12 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
result = (std::min)(run, result);
}
return result / iter;
}
catch(const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
return -1;
}
}
}