How come istringstream can't seem to fully read numeric literals with suffixes?
#include <iostream>
#include <sstream>
using namespace std;
int main() {
long long x = 123ULL; // shows 123ULL is a valid long long literal
istringstream iss("123ULL");
iss >> x;
cout << "x is " << x << endl;
char extra;
iss >> extra;
cout << "remaining characters: ";
while(!iss.eof())
{
cout << extra;
iss >> extra;
}
cout << endl;
return 0;
}
The output of this code is
x is 123
remaining characters: ULL
Is this behavior controlled by the locale? Could anyone point me to clear documentation on what strings are accepted by istringstream::operator>>(long long)
?