diff --git a/include/json/config.h b/include/json/config.h index 0dcd8ae..5ca3228 100644 --- a/include/json/config.h +++ b/include/json/config.h @@ -51,6 +51,16 @@ #define JSON_API #endif +#if !defined(JSON_HAS_UNIQUE_PTR) +#if __cplusplus >= 201103L +#define JSON_HAS_UNIQUE_PTR (1) +#elif _MSC_VER >= 1600 +#define JSON_HAS_UNIQUE_PTR (1) +#else +#define JSON_HAS_UNIQUE_PTR (0) +#endif +#endif + // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for // integer // Storages, and 64 bits integer support is disabled. diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index c133168..a2129be 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -43,7 +43,7 @@ static int stackDepth_g = 0; // see readValue() namespace Json { -#if __GNUC__ >= 6 +#if JSON_HAS_UNIQUE_PTR typedef std::unique_ptr const CharReaderPtr; #else typedef std::auto_ptr CharReaderPtr; diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index a04c66b..ec4b486 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -54,7 +54,7 @@ namespace Json { -#if __GNUC__ >= 6 +#if JSON_HAS_UNIQUE_PTR typedef std::unique_ptr const StreamWriterPtr; #else typedef std::auto_ptr StreamWriterPtr;