From 9f64feed0cf9e364b7282fbd1d11325305d70754 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 28 Mar 2020 17:46:47 -0400 Subject: [PATCH] fix compilation issue with string_view --- parallel_hashmap/phmap_config.h | 7 +++++-- parallel_hashmap/phmap_utils.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/parallel_hashmap/phmap_config.h b/parallel_hashmap/phmap_config.h index 49a14ce..dd5a0bf 100644 --- a/parallel_hashmap/phmap_config.h +++ b/parallel_hashmap/phmap_config.h @@ -296,7 +296,8 @@ #endif #ifdef __has_include - #if __has_include() && __cplusplus >= 201703L + #if __has_include() && __cplusplus >= 201703L && \ + (!defined(_MSC_VER) || _MSC_VER >= 1920) // vs2019 #define PHMAP_HAVE_STD_STRING_VIEW 1 #endif #endif @@ -308,7 +309,9 @@ // #define PHMAP_HAVE_STD_ANY 1 #define PHMAP_HAVE_STD_OPTIONAL 1 #define PHMAP_HAVE_STD_VARIANT 1 - #define PHMAP_HAVE_STD_STRING_VIEW 1 + #if !defined(PHMAP_HAVE_STD_STRING_VIEW) && _MSC_VER >= 1920 + #define PHMAP_HAVE_STD_STRING_VIEW 1 + #endif #endif #if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || __cplusplus >= 201703 diff --git a/parallel_hashmap/phmap_utils.h b/parallel_hashmap/phmap_utils.h index 76818f2..0f38efa 100644 --- a/parallel_hashmap/phmap_utils.h +++ b/parallel_hashmap/phmap_utils.h @@ -123,7 +123,7 @@ private: typedef std::true_type yes; typedef std::false_type no; - template static auto test(int) -> decltype(hash_value(std::declval()) == 1, yes()); + template static auto test(int) -> decltype(hash_value(std::declval()) == 1, yes()); template static no test(...);