Browse Source

Util: Reset IOstreams flags after usage

master
Riyyi 2 years ago
parent
commit
15a524adbb
  1. 14
      src/util/format/builder.cpp

14
src/util/format/builder.cpp

@ -6,7 +6,7 @@
#include <cstddef> // size_t
#include <iomanip> // setprecision
#include <ios> // fixed
#include <ios> // defaultfloat, fixed
#include <limits> // numeric_limits
#include <sstream> // stringstream
#include <string>
@ -32,9 +32,9 @@ void Builder::putF32(float number, size_t precision) const
std::stringstream stream;
stream
<< std::fixed
<< std::setprecision(precision)
<< number;
<< std::fixed << std::setprecision(precision)
<< number
<< std::defaultfloat << std::setprecision(6);
std::string string = stream.str();
string = string.substr(0, string.find_first_of('0', string.find('.')));
m_builder << string;
@ -46,9 +46,9 @@ void Builder::putF64(double number, size_t precision) const
std::stringstream stream;
stream
<< std::fixed
<< std::setprecision(precision)
<< number;
<< std::fixed << std::setprecision(precision)
<< number
<< std::defaultfloat << std::setprecision(6);
std::string string = stream.str();
string = string.substr(0, string.find_first_of('0', string.find('.')));
m_builder << string;

Loading…
Cancel
Save