提交 29c5f32d 编写于 作者: N Niels

fixed performance degradation (#272)

上级 87dea32e
...@@ -66,6 +66,9 @@ fuzz: test/src/fuzz.cpp src/json.hpp ...@@ -66,6 +66,9 @@ fuzz: test/src/fuzz.cpp src/json.hpp
cppcheck: cppcheck:
cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1 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 # maintainer targets
########################################################################## ##########################################################################
......
...@@ -2232,7 +2232,8 @@ class basic_json ...@@ -2232,7 +2232,8 @@ class basic_json
{ {
std::stringstream ss; std::stringstream ss;
// fix locale problems // 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 // 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long // string->float->string, string->double->string or string->long
......
...@@ -2232,7 +2232,8 @@ class basic_json ...@@ -2232,7 +2232,8 @@ class basic_json
{ {
std::stringstream ss; std::stringstream ss;
// fix locale problems // 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 // 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long // string->float->string, string->double->string or string->long
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册