diff --git a/parallel_hashmap/phmap_base.h b/parallel_hashmap/phmap_base.h index 0b6674a..8be4e0e 100644 --- a/parallel_hashmap/phmap_base.h +++ b/parallel_hashmap/phmap_base.h @@ -329,10 +329,10 @@ template using underlying_type_t = typename std::underlying_type::type; template< class F, class... ArgTypes> -#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -using invoke_result_t = typename std::invoke_result_t; +#ifdef PHMAP_HAVE_CC17 + using invoke_result_t = typename std::invoke_result_t; #else -using invoke_result_t = typename std::result_of::type; + using invoke_result_t = typename std::result_of::type; #endif namespace type_traits_internal { diff --git a/parallel_hashmap/phmap_config.h b/parallel_hashmap/phmap_config.h index dd5a0bf..5e527cc 100644 --- a/parallel_hashmap/phmap_config.h +++ b/parallel_hashmap/phmap_config.h @@ -109,6 +109,7 @@ #endif + // ----------------------------------------------------------------------------- // Compiler Feature Checks // ----------------------------------------------------------------------------- @@ -119,6 +120,12 @@ #define PHMAP_HAVE_BUILTIN(x) 0 #endif +#if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || __cplusplus >= 201703 + #define PHMAP_HAVE_CC17 1 +#else + #define PHMAP_HAVE_CC17 0 +#endif + // ---------------------------------------------------------------- // Checks whether `std::is_trivially_destructible` is supported. // ---------------------------------------------------------------- @@ -304,8 +311,7 @@ // #pragma message(PHMAP_VAR_NAME_VALUE(_MSVC_LANG)) -#if defined(_MSC_VER) && _MSC_VER >= 1910 && \ - ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || __cplusplus >= 201703) +#if defined(_MSC_VER) && _MSC_VER >= 1910 && PHMAP_HAVE_CC17 // #define PHMAP_HAVE_STD_ANY 1 #define PHMAP_HAVE_STD_OPTIONAL 1 #define PHMAP_HAVE_STD_VARIANT 1 @@ -314,7 +320,7 @@ #endif #endif -#if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) || __cplusplus >= 201703 +#if PHMAP_HAVE_CC17 #define PHMAP_HAVE_SHARED_MUTEX 1 #endif @@ -633,7 +639,7 @@ // ---------------------------------------------------------------------- // constexpr if // ---------------------------------------------------------------------- -#if __cplusplus >= 201703 || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703) +#if PHMAP_HAVE_CC17 #define PHMAP_IF_CONSTEXPR(expr) if constexpr ((expr)) #else #define PHMAP_IF_CONSTEXPR(expr) if ((expr))