VCCC  2024.05
VisualCamp Common C++ library
swappable.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-03.
3 //
4 
5 #ifndef VCCC_CONCEPTS_SWAPPABLE_HPP_
6 #define VCCC_CONCEPTS_SWAPPABLE_HPP_
7 
8 #include <type_traits>
9 
10 #include "vccc/__concepts/swap.hpp"
13 
14 namespace vccc {
15 namespace detail {
16 
18 struct swappable_impl : std::false_type {};
19 
20 template<typename T>
21 struct swappable_impl<T, true, void_t<decltype(ranges::swap(std::declval<T&>(), std::declval<T&>()))>>
22  : std::true_type {};
23 
24 } // namespace detail
25 
28 
36 template<typename T>
37 struct swappable : detail::swappable_impl<T> {};
38 
40 
41 } // namespace vccc
42 
43 #endif // VCCC_CONCEPTS_SWAPPABLE_HPP_
void void_t
Definition: void_t.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: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
specifies that a type can be swapped or that two types can be swapped with each other
Definition: swappable.hpp:37