我不確定如何使用boost::is_any_of
使用一組字符拆分字符串,其中任何一個字符都應拆分字符串。使用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));
但是,這會產生一個boost/STD錯誤列表。 我應該堅持is_any_of
還是有更好的方法來做到這一點,例如。使用正則表達式分割?
「is_any_of」沒有采用迭代器範圍是一件很遺憾的事情。 – Inverse 2011-02-25 17:45:52