From: Christopher Dykes Date: Tue, 16 Aug 2016 23:27:28 +0000 (-0700) Subject: Use std::is_nothrow_swappable under MSVC X-Git-Tag: v2016.08.22.00~26 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=30c4c2864581aa35359eb1aba09300698a383848;p=folly.git Use std::is_nothrow_swappable under MSVC Summary: The current implementation didn't work for MSVC, as it tries to evaluate `noexcept` expressions in base class lists before the template is instantiated. `std::is_nothrow_swappable` is coming in C++17, and MSVC already has it, so use it instead. Reviewed By: yfeldblum Differential Revision: D3724399 fbshipit-source-id: 7927584618a7870824b2e7242fcae562647f4ef4 --- diff --git a/folly/Traits.h b/folly/Traits.h index 3421d665..fc3cba9c 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -159,6 +159,12 @@ 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. +template +using IsNothrowSwappable = std::is_nothrow_swappable; +#else /* using override */ using std::swap; template @@ -167,6 +173,7 @@ struct IsNothrowSwappable std::is_nothrow_move_constructible::value && noexcept(swap(std::declval(), std::declval())) > {}; +#endif } /* using override */ using traits_detail_IsNothrowSwappable::IsNothrowSwappable;