【发布时间】:2019-08-04 20:51:59
【问题描述】:
我将 boost::regex_match 与 boost::string_ref 一起使用,但由于模板推断错误导致构建失败,我该如何解决?
boost::smatch base;
boost::string_ref sr = "4f000000-4f015000 r-xp 00000000 03:01 12845071 /lib/ld-2.3.2.so";
boost::regex
re(R"(^([[:xdigit:]]+)-([[:xdigit:]]+)\s+..x.\s+([[:xdigit:]]+)\s+\S+:\S+\s+\d+\s+(\S+\.(so|dll|dylib|bundle)((\.\d+)+\w*(\.\d+){0,3})?)$)");
if (boost::regex_match(sr.cbegin(), sr.cend(), base, re)) {
std::cout << base[0] << std::endl;
}
编译器错误:
/usr/include/boost/regex/v4/regex_match.hpp|44 col 6|注:候选人: 模板 bool boost::regex_match(BidiIterator, BidiIterator, boost::match_results&, 常量 boost::basic_regex&, boost::regex_constants::match_flag_type)
|| bool regex_match(BidiIterator first, BidiIterator last,
|| ^
/usr/include/boost/regex/v4/regex_match.hpp|44 col 6|注:模板 参数推导/替换失败:
正则表达式.cpp|161 列 58|注意:推断参数的冲突类型 'Iterator' ('const char*' 和 '__gnu_cxx::__normal_iterator >')
【问题讨论】: