From d468f8c4e65087aa9df2899c2c37e46a4c423f98 Mon Sep 17 00:00:00 2001 From: Jamie Seward Date: Sat, 21 Oct 2017 16:36:05 -0700 Subject: [PATCH] Use consistent logic to determine if string_view exists --- src/json.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 4a5e14d42..2e619c858 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -110,11 +110,11 @@ SOFTWARE. #endif // string_view support -#if defined(_MSC_VER) && defined(_HAS_CXX17) && _HAS_CXX17 == 1 - #define JSON_USE_STRING_VIEW +#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_MSC_VER) && _MSC_VER > 1900 && defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_STRING_VIEW #endif -#if defined(JSON_USE_STRING_VIEW) +#if defined(JSON_HAS_STRING_VIEW) #include #endif @@ -7600,7 +7600,7 @@ class basic_json specified "unordered" nature of JSON objects. */ -#if defined(JSON_USE_STRING_VIEW) +#if defined(JSON_HAS_STRING_VIEW) // if std::string_view is to be used the object_t must // be declared with a transparent comparator // https://stackoverflow.com/questions/35525777/use-of-string-view-for-map-lookup @@ -9868,7 +9868,7 @@ class basic_json #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value #endif -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_MSC_VER) && _MSC_VER >1900 && defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +#if defined(JSON_HAS_STRING_VIEW) and not std::is_same::value #endif , int >::type = 0 >