You are viewing a single comment's thread. Return to all comments →
I don't know why these two methods give the same result.
std::vector<int> parseInts(std::string str) { std::stringstream stream; stream.str(str); std::vector<int> ints; int val = 0; while (stream) { stream >> val; ints.push_back(val); if (stream.peek() == ',') { stream.ignore(); } } return ints; }
std::vector<int> parseInts(std::string str) { std::stringstream stream; stream.str(str); std::vector<int> ints; int val = 0; while (stream >> val) { ints.push_back(val); if (stream.peek() == ',') { stream.ignore(); } } return ints; }
Seems like cookies are disabled on this browser, please enable them to open this website
StringStream
You are viewing a single comment's thread. Return to all comments →
I don't know why these two methods give the same result.