You are viewing a single comment's thread. Return to all comments →
I skipped the comma by incrementing the position in the input sequence.
vector<int> parseInts(string str) { stringstream ss(str); vector<int> v; int i; while(ss >> i) { ss.seekg(ss.tellg() + 1); v.push_back(i); } return v; }
Any downsides to doing it this way? Performance, memory, edge cases?
StringStream
You are viewing a single comment's thread. Return to all comments →
I skipped the comma by incrementing the position in the input sequence.
Any downsides to doing it this way? Performance, memory, edge cases?