5 #ifndef VCCC_TYPE_TRAITS_IS_SWAPPABLE_HPP
6 #define VCCC_TYPE_TRAITS_IS_SWAPPABLE_HPP
22 template<
typename T>
struct is_swappable;
23 template<
typename T>
struct is_nothrow_swappable;
27 namespace swappable_test_std {
29 # if __cplusplus < 201703L
31 template<
typename T,
typename U>
32 struct is_swappable_with_impl : conjunction<
33 std::is_convertible<decltype(std::declval<U>()), decltype(std::declval<T>())>,
34 std::is_convertible<decltype(std::declval<T>()), decltype(std::declval<U>())>,
35 std::is_move_constructible<std::remove_reference_t<T>>, std::is_move_assignable<std::remove_reference_t<T>>,
36 std::is_move_constructible<std::remove_reference_t<U>>, std::is_move_assignable<std::remove_reference_t<U>>
38 static constexpr
bool nothrow =
39 std::is_nothrow_move_constructible<std::remove_reference_t<T>>
::value && std::is_nothrow_move_assignable<std::remove_reference_t<T>>
::value &&
40 std::is_nothrow_move_constructible<std::remove_reference_t<U>>
::value && std::is_nothrow_move_assignable<std::remove_reference_t<U>>
::value;
43 template<
typename T, std::
size_t N>
44 struct is_swappable_with_impl<T(&)[N], T(&)[N]> : is_swappable<T> {
50 template<
typename T,
typename U,
typename =
void>
51 struct is_swappable_with_impl : std::false_type {};
53 template<
typename T,
typename U>
54 struct is_swappable_with_impl<T, U,
void_t<
55 decltype((
swap(
std::declval<T>(), std::declval<U>()),
56 swap(std::declval<U>(), std::declval<T>()))
59 static constexpr
bool nothrow
60 = noexcept(
swap(std::declval<T>(), std::declval<U>())) &&
61 noexcept(
swap(std::declval<U>(), std::declval<T>()));
69 namespace swappable_test_adl {
71 template<
typename T,
typename U,
typename =
void>
72 struct is_swappable_with_impl : std::false_type {};
74 template<
typename T,
typename U>
75 struct is_swappable_with_impl<T, U,
void_t<
76 decltype((
swap(
std::declval<T>(), std::declval<U>()),
77 swap(std::declval<U>(), std::declval<T>())))>> : std::true_type {
78 static constexpr
bool nothrow
79 = noexcept(
swap(std::declval<T>(), std::declval<U>())) &&
80 noexcept(
swap(std::declval<U>(), std::declval<T>()));
85 #if __cplusplus < 201703L
87 template<
typename T,
typename U>
88 struct is_swappable_with_impl :
89 disjunction<swappable_test_adl::is_swappable_with_impl<T, U>,
90 swappable_test_std::is_swappable_with_impl<T, U>> {};
93 struct is_nothrow_swappable_with_impl :
bool_constant<is_swappable_with_impl<T, U>::nothrow> {};
95 template<
typename T,
typename U>
96 struct is_nothrow_swappable_with_impl<T, U, false> : std::false_type {};
100 template<
typename T,
typename U>
101 struct is_swappable_with_impl : std::is_swappable_with<T, U> {};
103 template<
typename T,
typename U>
104 struct is_nothrow_swappable_with_impl : std::is_nothrow_swappable_with<T, U> {};
110 template<
typename T,
typename U>
116 !is_referencable<T>::value,
118 is_swappable_with<std::add_lvalue_reference_t<T>, std::add_lvalue_reference_t<T>>
121 template<
typename T,
typename U>
132 # if __cplusplus < 201703L
void swap(::vccc::optional< T > &lhs, ::vccc::optional< T > &rhs) noexcept(noexcept(lhs.swap(rhs)))
Definition: swap.h:30
std::integral_constant< bool, v > bool_constant
Definition: bool_constant.hpp:19
constexpr std::enable_if_t< conjunction< is_swappable< T >, is_swappable< U > >::value > swap(compressed_pair< T, U > &lhs, compressed_pair< T, U > &rhs) noexcept(conjunction< is_nothrow_swappable< T >, is_nothrow_swappable< U >>::value)
Definition: compressed_pair.hpp:108
Definition: matrix.hpp:495
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: is_swappable.hpp:122
Definition: is_swappable.hpp:125
Definition: is_swappable.hpp:111
Definition: is_swappable.hpp:119