VCCC  2024.05
VisualCamp Common C++ library
indirectly_swappable.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2023/12/27.
3 //
4 
5 #ifndef VCCC_ITERATOR_INDIRECTLY_SWAPPABLE_HPP
6 #define VCCC_ITERATOR_INDIRECTLY_SWAPPABLE_HPP
7 
8 #include <type_traits>
9 
14 
15 namespace vccc {
16 namespace detail {
17 
18 template<typename I1, typename I2, typename = void>
19 struct indirectly_swappable_test_iter_swap : std::false_type {};
20 template<typename I1, typename I2>
21 struct indirectly_swappable_test_iter_swap<
22  I1, I2, void_t<decltype(ranges::iter_swap(std::declval<const I1&>(), std::declval<const I2&>()))>> : std::true_type {};
23 
24 template<
25  typename I1,
26  typename I2,
27  bool = conjunction< indirectly_readable<I1>, indirectly_readable<I2>>::value /* true */
28 >
29 struct indirectly_swappable_impl
30  : conjunction<
31  indirectly_swappable_test_iter_swap<I1, I1>,
32  indirectly_swappable_test_iter_swap<I2, I2>,
33  indirectly_swappable_test_iter_swap<I1, I2>,
34  indirectly_swappable_test_iter_swap<I2, I1>
35  >{};
36 
37 template<typename I1, typename I2>
38 struct indirectly_swappable_impl<I1, I2, false> : std::false_type {};
39 
40 } // namespace detail
41 
44 
45 template<typename I1, typename I2 = I1>
46 struct indirectly_swappable : detail::indirectly_swappable_impl<I1, I2> {};
47 
49 
50 } // namespace vccc
51 
52 #endif // VCCC_ITERATOR_INDIRECTLY_SWAPPABLE_HPP
constexpr VCCC_INLINE_OR_STATIC detail_iter_swap::iter_swap_niebloid iter_swap
Definition: iter_swap.hpp:90
void void_t
Definition: void_t.hpp:19
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: indirectly_swappable.hpp:46