我有一个用boost :: xpressive
编写的非常短的程序
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
using namespace boost::xpressive;
int main()
{
std::string hello( "hello world!" );
sregex rex = sregex::compile( "(\\w+) (\\w+)!" );
smatch what;
if( regex_match( hello, what, rex ) )
{
std::cout << what[0] << '\n'; // whole match
std::cout << what[1] << '\n'; // first capture
std::cout << what[2] << '\n'; // second capture
}
return 0;
}
这是Xpressive“你好世界”。编译需要比普通的hello世界更长的时间。我认为这是因为xpressive.hpp文件非常庞大。有没有办法预编译或预处理.hpp文件,以便编译速度更快?