What is the most elegant way to iterate the words of a string? The string can be assumed to be composed of words separated by whitespace.
Note that I'm not interested in C string functions or that kind of character manipulation/access. Also, please give precedence to elegance over efficiency in your answer.
The best solution I have right now is:
using namespace std;
string s = "Somewhere down the road";
iss >> subs;
cout << "Substring: " << subs << endl;
} while (iss);