有没有人知道的boost::split
一条捷径。那
std::vector<std::string> args;
boost::split(args, argsString, boost::is_any_of("\t "), boost::token_compress_on);
变
auto const args = boost::split(args, argsString, boost::is_any_of("\t "), boost::token_compress_on);
or
auto const args = boost::split<std::vector>(args, argsString, boost::is_any_of("\t "), boost::token_compress_on);
基本上是相同的像有,例如,一个用于trim
- trim_copy
。
没有快捷方式在升压存在,据我所知。就个人而言,我写了一个简单的包装为split
因为我有同样的问题,它是你做的:
template <typename RangeT, typename PredicateT>
std::vector<std::string> split(RangeT& Input, PredicateT Pred,
boost::algorithm::token_compress_mode_type eCompress = boost::token_compress_off)
{
std::vector<std::string> toReturn;
boost::split(toReturn, Input, Pred, eCompress);
return toReturn;
}