My common convention when I want to take a string and tokenize it is as follows
the vectors size is 3 in this case because the last string pushed into the vector is empty..Code:string str = "hello world";
vector<string> vs;
istringstream iss(str);
while(iss)
{
string t;
iss >> t;
vs.push_back(t);
}
cout << vs.size();
what does iss evaluate to when its 'empty' that causes this last iteration of an empty string being pushed?
thanks