【发布时间】:2015-03-11 17:59:24
【问题描述】:
我正在尝试使用正则表达式在 C++ 中编写拆分函数。到目前为止,我已经想出了这个;
vector<string> split(string s, regex r)
{
vector<string> splits;
while (regex_search(s, r))
{
int split_on = // index of regex match
splits.push_back(s.substr(0, split_on));
s = s.substr(split_on + 1);
}
splits.push_back(s);
return splits;
}
我想知道的是如何填写注释行。
【问题讨论】: