From 3259ce0e737922616205bd72cda16f59722cf4ea Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Mon, 6 Feb 2017 13:44:18 -0800 Subject: [PATCH] Support compiling in C++14 mode Summary: The rest of Folly isn't dependent on C++17 mode in MSVC, so modify this to support not having it enabled. This will make adoption easier as C++17 mode acts on the things the standard says are removed. Reviewed By: yfeldblum Differential Revision: D4509919 fbshipit-source-id: f4644f5f5ba78de8ab5192b89ac6320767b51084 --- folly/Traits.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/folly/Traits.h b/folly/Traits.h index ed46cba9..877a325f 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -302,11 +302,18 @@ struct IsLessThanComparable IsLessThanComparable; namespace traits_detail_IsNothrowSwappable { -#if defined(_MSC_VER) || defined(__cpp_lib_is_swappable) -// MSVC already implements the C++17 P0185R1 proposal which -// adds std::is_nothrow_swappable, so use it instead. +#if defined(__cpp_lib_is_swappable) || (_CPPLIB_VER && _HAS_CXX17) +// MSVC 2015+ already implements the C++17 P0185R1 proposal which +// adds std::is_nothrow_swappable, so use it instead if C++17 mode +// is enabled. template using IsNothrowSwappable = std::is_nothrow_swappable; +#elif _CPPLIB_VER +// MSVC 2015+ defines the base even if C++17 is disabled, and +// MSVC 2015 has issues with our fallback implementation due to +// over-eager evaluation of noexcept. +template +using IsNothrowSwappable = std::_Is_nothrow_swappable; #else /* using override */ using std::swap; -- 2.34.1