提升分割用量

Man*_*noj 4 c++ string boost split

我有一串格式[id1,id2,id3].我正在使用boost split来分割字符串并将其填充到矢量中.

boost::split(ids, message, boost::is_any_of("[, ]"));
Run Code Online (Sandbox Code Playgroud)

id是我的向量声明为std::vector<std::string> ids.

现在只有向量的奇数索引包含id,偶数为空.谁能告诉我可能是什么原因以及如何解决它.

Shu*_*huo 7

boost::algorithm::split( ids, message, boost::is_any_of("[, ]"),
                         boost::algorithm::token_compress_on );
Run Code Online (Sandbox Code Playgroud)