我不确定如何boost::is_any_of使用一组字符来分割字符串,其中任何一个字符都应该拆分字符串.
我想做这样的事情,因为我理解is_any_of函数采用Set参数.
std::string s_line = line = "Please, split|this string";
std::set<std::string> delims;
delims.insert("\t");
delims.insert(",");
delims.insert("|");
std::vector<std::string> line_parts;
boost::split ( line_parts, s_line, boost::is_any_of(delims));
Run Code Online (Sandbox Code Playgroud)
但是,这会产生一个boost/STD错误列表.我应该坚持is_any_of还是有更好的方法来做到这一点,例如.使用正则表达式拆分?