input operators shouldn't clear eof
oncaphillis at snafu.de
Tue Dec 21 11:31:29 CET 2010
This may be more a feature request then a bug report, but the input operator
of gmpxx shouldn't clear the eof flag on the istream.
I very often so string=>number conversion via std::stringstream like in the
typedef mpz_class Value_t;
typedef int64_t Value_t;
Value_t FromString(const std::string & rVal)
if( ! (ss >> v) || !ss.eof() )
std::cerr << " failed to parse '" << rVal << "' as a number "
Checking eof here tells me that the string has been completely parsed.
It works fine
with standard types but fails on gmpxx. Checked it on 4.3.2 and 5.0.1
I attached a patch against 5.0.1
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1351 bytes
Desc: not available
More information about the gmp-bugs