Manoj
Manoj

Reputation: 5612

boost split usage

I have a string of format [id1,id2,id3]. i'm using boost split to split the string and fill it in a vector.

boost::split(ids, message, boost::is_any_of("[, ]"));

ids is my vector declared as std::vector<std::string> ids.

now only the odd indices of the vector contains the ids, the even ones are empty. can anyone tell me what could be the reason and how to fix it.

Upvotes: 4

Views: 3389

Answers (1)

Shuo
Shuo

Reputation: 8937

boost::algorithm::split( ids, message, boost::is_any_of("[, ]"),
                         boost::algorithm::token_compress_on );

Upvotes: 7

Related Questions