Commit 30c4c286 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 4

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
parent 4da4f331
...@@ -159,6 +159,12 @@ struct IsLessThanComparable ...@@ -159,6 +159,12 @@ struct IsLessThanComparable
IsLessThanComparable; IsLessThanComparable;
namespace traits_detail_IsNothrowSwappable { 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 <typename T>
using IsNothrowSwappable = std::is_nothrow_swappable<T>;
#else
/* using override */ using std::swap; /* using override */ using std::swap;
template <class T> template <class T>
...@@ -167,6 +173,7 @@ struct IsNothrowSwappable ...@@ -167,6 +173,7 @@ struct IsNothrowSwappable
std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_constructible<T>::value &&
noexcept(swap(std::declval<T&>(), std::declval<T&>())) noexcept(swap(std::declval<T&>(), std::declval<T&>()))
> {}; > {};
#endif
} }
/* using override */ using traits_detail_IsNothrowSwappable::IsNothrowSwappable; /* using override */ using traits_detail_IsNothrowSwappable::IsNothrowSwappable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment