You are viewing a single comment's thread. Return to all comments →
vector parseInts(string str) { vector ret; int extracted; stringstream ss; ss.str(str); while (!ss.eof()) { if (ss.peek() != ',') { ss >> extracted; ret.push_back(extracted); } else { ss.get(); } } return ret; }
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 →
vector parseInts(string str) { vector ret; int extracted; stringstream ss; ss.str(str); while (!ss.eof()) { if (ss.peek() != ',') { ss >> extracted; ret.push_back(extracted);
} else { ss.get(); } } return ret; }