I have a function recieving a string, which is a pair of comma delimited integers in a fashion such as \"12,4\". How can I parse the integers out of this string?
std::getline
implements the basic "split" functionality (I don't see it mentioned in the first few answers at the other question.)
vector< int > numbers;
istringstream all_numbers_iss( "12,4" );
string number_str;
int number;
while ( getline( all_numbers_iss, number_str, ',' ) // separate at comma
&& istringstream( number_str ) >> number ) {
numbers.push_back( number );
}