【发布时间】:2016-02-24 23:08:50
【问题描述】:
我正在尝试使用gsl::span 将一些数据从混合二进制/ascii 数据的打包结构(因此没有vector 或string)传递给一个函数,我想在其中使用正则表达式,但我收到以下错误:
错误 C2784:'bool std::regex_match(_BidIt,_BidIt,std::match_results<_bidit> &,const std::basic_regex<_elem> &,std::regex_constants::match_flag_type)':无法从 'std::cmatch' 推断出 'std::match_results>,_Alloc> &' 的模板参数
参见“std::regex_match”的声明
这是我想要做的:
#include <regex>
#include "gsl.h"
using namespace std;
using namespace gsl;
int main(int argc, const char **argv)
{
char lat[8] = { '0', '1', '9', '0', '0', '0', '0', 'E' };
span<char> s = lat;
// in a complex implementation this would be in a function,
// hence the desire for span<>
std::cmatch match;
std::regex_match(s.begin(), s.end(), match, std::regex("[0-9]+"));
}
【问题讨论】:
标签: c++ regex c++11 guideline-support-library