Could use boost string algorithms library:

```c++
std::vector<std::string> words;
std::string s;
std::string delim;
boost::split(words, s, boost::is_any_of(delim), boost::token_compress_on);
```