I have this code to split a string. For some reason, it just sits there doing nothing. I am not sure what the problem is. By the way, delim = ' '
here.
vector<string> split( const string &str, const char &delim )
{
typedef string::const_iterator iter;
iter beg = str.begin();
vector<string> tokens;
while(beg != str.end())
{
iter temp = find(beg, str.end(), delim);
if(beg != str.end())
tokens.push_back(string(beg, temp));
beg = temp;
}
return tokens;
}
See Question&Answers more detail:os