1
这看起来简单直白,但在调用f(m)
时出现页面“失败的替换”时失败。这是为什么?为什么在使用smatch :: str时mem_fn无法编译?
string const input = "The quick brown fox.";
std::regex const words("[^\\s]+");
auto f = std::mem_fn(&std::smatch::str);
std::sregex_iterator i = std::sregex_iterator(input.begin(), input.end(), words);
std::smatch m = *i;
string first_word = f(m);