Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitHub Actions <action@github.com>2020-06-28 14:43:45 +0300
committerGitHub Actions <action@github.com>2020-06-28 14:43:45 +0300
commit83d5cb38342f030a533ba1ec963b716411cb353e (patch)
treeeb2192a55f475f50a0da58e294d3a1cceb6eb92d
parent69d0b3584248a6a2eaf5938bef59bd497743d374 (diff)
Upstream release v2.0.1v2.0.1
-rw-r--r--README.md2
-rw-r--r--include/nlohmann/json.hpp16
2 files changed, 11 insertions, 7 deletions
diff --git a/README.md b/README.md
index 2c70f79..886dc1b 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ include(FetchContent)
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohman_json
- GIT_TAG v2.0.0)
+ GIT_TAG v2.0.1)
FetchContent_GetProperties(json)
if(NOT json_POPULATED)
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index b02a134..35bdd29 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
-| | |__ | | | | | | version 2.0.0
+| | |__ | | | | | | version 2.0.1
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
@@ -2097,6 +2097,8 @@ class basic_json
string_t dump(const int indent = -1) const
{
std::stringstream ss;
+ // fix locale problems
+ ss.imbue(std::locale(std::locale(), new DecimalSeparator));
if (indent >= 0)
{
@@ -5655,9 +5657,14 @@ class basic_json
// reset width to 0 for subsequent calls to this stream
o.width(0);
+ // fix locale problems
+ auto old_locale = o.imbue(std::locale(std::locale(), new DecimalSeparator));
// do the actual serialization
j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
+
+ // reset locale
+ o.imbue(old_locale);
return o;
}
@@ -6128,11 +6135,8 @@ class basic_json
// string->double->string or string->long
// double->string; to be safe, we read this value from
// std::numeric_limits<number_float_t>::digits10
- std::stringstream ss;
- ss.imbue(std::locale(std::locale(), new DecimalSeparator)); // fix locale problems
- ss << std::setprecision(std::numeric_limits<double>::digits10)
- << m_value.number_float;
- o << ss.str();
+ o << std::setprecision(std::numeric_limits<double>::digits10)
+ << m_value.number_float;
}
return;
}