From 1e5e6489189c52153f3a197f8bf7c7693ea30902 Mon Sep 17 00:00:00 2001 From: Shane Grant Date: Fri, 5 Aug 2016 13:48:53 -0700 Subject: [PATCH] nan support following #300 (see #285) --- include/cereal/archives/json.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/cereal/archives/json.hpp b/include/cereal/archives/json.hpp index ec33b5c22..3eb95db5f 100644 --- a/include/cereal/archives/json.hpp +++ b/include/cereal/archives/json.hpp @@ -46,6 +46,10 @@ namespace cereal throw ::cereal::RapidJSONException("rapidjson internal assertion failure: " #x); } #endif // RAPIDJSON_ASSERT +// Enable support for parsing of nan, inf, -inf +#define CEREAL_RAPIDJSON_WRITE_DEFAULT_FLAGS kWriteNanAndInfFlag +#define CEREAL_RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag | kParseNanAndInfFlag + #include #include #include @@ -420,7 +424,7 @@ namespace cereal itsNextName( nullptr ), itsReadStream(stream) { - itsDocument.ParseStream(itsReadStream); + itsDocument.ParseStream<>(itsReadStream); if (itsDocument.IsArray()) itsIteratorStack.emplace_back(itsDocument.Begin(), itsDocument.End()); else