1
0
mirror of https://github.com/nlohmann/json synced 2024-11-15 16:50:06 +00:00

fixed performance degradation (#272)

This commit is contained in:
Niels 2016-08-29 22:36:33 +02:00
parent 87dea32e81
commit 29c5f32d42
3 changed files with 7 additions and 2 deletions

View File

@ -66,6 +66,9 @@ fuzz: test/src/fuzz.cpp src/json.hpp
cppcheck:
cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1
clang_sanitize: clean
CXX=clang++ CXXFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" $(MAKE)
##########################################################################
# maintainer targets
##########################################################################

View File

@ -2232,7 +2232,8 @@ class basic_json
{
std::stringstream ss;
// fix locale problems
ss.imbue(std::locale(std::locale(), new DecimalSeparator));
const static std::locale loc(std::locale(), new DecimalSeparator);
ss.imbue(loc);
// 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long

View File

@ -2232,7 +2232,8 @@ class basic_json
{
std::stringstream ss;
// fix locale problems
ss.imbue(std::locale(std::locale(), new DecimalSeparator));
const static std::locale loc(std::locale(), new DecimalSeparator);
ss.imbue(loc);
// 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long