Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use __has_include instead?

#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