I am trying to split a comma-separated string and then perform some action on each token, but ignoring duplicates, so sth. along the following lines:
int main(int, char**)
{
string text = "token, test string";
char_separator<char> sep(", ");
tokenizer< char_separator<char> > tokens(text, sep);
// remove duplicates from tokens?
BOOST_FOREACH (const string& t, tokens) {
cout << t << "." << endl;
}
}
Is there a way to do this on the boost::tokenizer?
I know that I can solve this problem using boost::split and std::unique, but was wondering whether there is a way to achieve this with the tokenizer as well.