Hi,
Take this code:
#include <sstream>
#include <cassert>
#include <locale>
int main()
{
std::istringstream iss;
iss.str("{1,}");
char ch;
int n;
iss >> ch;
iss >> n; // works on vc7.1, fail on vc8
assert(!iss.fail());
iss >> ch;
}
apparently the locale being used by istringstream on vc8 is using a grouping
configuration of 3. On vc7.1 the configuration is 0.
I solved this by doing:
class my_numpunct : public std::numpunct_byname<char> {
public:
my_numpunct (const char *name)
: std::numpunct_byname<char>(name) {}
protected:
virtual std::string do_grouping() const {
return "";
}
};
And then
iss.imbue(std::locale(std::locale(""), new my_numpunct("")));
Is this the correct solution?
regards,
Josue