From 0d1ee21cb2335181d4d1108cda1216b11e95d298 Mon Sep 17 00:00:00 2001 From: fabian Date: Tue, 23 Apr 2024 12:13:57 +0200 Subject: [PATCH] make project compileable with VS2013 --- include/json/value.h | 8 ++++++++ src/lib_json/json_value.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/json/value.h b/include/json/value.h index c2efe95..8b9efd1 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -256,7 +256,15 @@ public: // The constant is hard-coded because some compiler have trouble // converting Value::maxUInt64 to a double correctly (AIX/xlC). // Assumes that UInt64 is a 64 bits integer. +#if JSONCPP_CXX_STD_11 static JSONCPP_CONST double maxUInt64AsDouble = 18446744073709551615.0; +#else + // In-class initializer for static data member of type 'const double' is a GNU + // extension. JSONCPP_CONST == const, if C++0x. + // So initialization has to be done in json_value.cpp to make this project + // compileable with e.g. VS2013 + static JSONCPP_CONST double maxUInt64AsDouble; +#endif // Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler // when using gcc and clang backend compilers. CZString // cannot be defined as private. See issue #486 diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 2938ea5..64ef81b 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -334,6 +334,16 @@ bool Value::CZString::isStaticString() const { // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// +#if JSONCPP_CXX_STD_11 + +#else +// In-class initializer for static data member of type 'const double' is a GNU +// extension. JSONCPP_CONST == const, if C++0x. +// So initialization has to be done in json_value.cpp to make this project +// compileable with e.g. VS2013. +JSONCPP_CONST double Value::maxUInt64AsDouble = 18446744073709551615.0; +#endif + /*! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator.