25class outputstream_num_put :
public std::num_put<char>
28 virtual iter_type do_put(iter_type s, std::ios_base&, char_type,
double v)
const override
31 return std::copy(str.begin(), str.end(), s);
33 virtual iter_type do_put(iter_type, std::ios_base&, char_type,
long double)
const override
37 using std::num_put<char>::do_put;
45 setf(std::ios::showpoint);
50 imbue(std::locale(std::locale(
"C"),
new outputstream_num_put));
58 stream.precision(std::numeric_limits<double>::digits10 + 1);
59 stream.setf(std::ios::showpoint);
61 std::string str =
stream.str();
62 size_t end = str.find(
'e');
63 if (
end == std::string::npos)
79 str.resize(std::copy(str.begin() +
end, str.end(), str.begin() +
pos) - str.begin());
Reference< XOutputStream > stream
std::string preciseFloat(double f)
CAUTION! The following defines must be in the same namespace as the respective type.