Skip to content

Commit

Permalink
Use consistent logic to determine if string_view exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jseward committed Oct 21, 2017
1 parent 59cde1a commit d468f8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string_view>
#endif

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -9868,7 +9868,7 @@ class basic_json
#ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::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<ValueType, typename std::string_view>::value
#endif
, int >::type = 0 >
Expand Down

0 comments on commit d468f8c

Please sign in to comment.