VCCC  2024.05
VisualCamp Common C++ library
comparison_common_type_with.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2023/12/27.
3 //
4 
5 #ifndef VCCC_CONCEPTS_COMPARISON_COMMON_TYPE_WITH_HPP
6 #define VCCC_CONCEPTS_COMPARISON_COMMON_TYPE_WITH_HPP
7 
15 
16 namespace vccc {
17 namespace detail {
18 
19 template<typename T, typename U, typename C = common_reference_t<const T&, const U&>>
20 struct comparison_common_type_with_impl_3
21  : conjunction<
22  same_as<common_reference_t<const T&, const U&>,
23  common_reference_t<const U&, const T&>>,
24  disjunction<convertible_to<const T&, const C&>,
25  convertible_to<T, const C&>>,
26  disjunction<convertible_to<const U&, const C&>,
27  convertible_to<U, const C&>>
28  > {};
29 
30 template<
31  typename T,
32  typename U,
33  bool = conjunction<has_typename_type< common_reference<const T&, const U&> >,
34  has_typename_type< common_reference<const U&, const T&> >>::value /* true */
35 >
36 struct comparison_common_type_with_impl_2 : comparison_common_type_with_impl_3<T, U> {};
37 
38 template<typename T, typename U>
39 struct comparison_common_type_with_impl_2<T, U, false> : std::false_type {};
40 
41 template<typename T, typename U, bool = conjunction<is_referencable<T>, is_referencable<U>>::value /* true */>
42 struct comparison_common_type_with_impl_1 : comparison_common_type_with_impl_2<T, U> {};
43 
44 template<typename T, typename U>
45 struct comparison_common_type_with_impl_1<T, U, false> : std::false_type {};
46 
47 } // namespace detail
48 
51 
63 template<typename T, typename U>
65  : detail::comparison_common_type_with_impl_1<remove_cvref_t<T>, remove_cvref_t<U>> {};
66 
68 
69 } // namespace vccc
70 
71 #endif // VCCC_CONCEPTS_COMPARISON_COMMON_TYPE_WITH_HPP
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
specifies that two types share a common type, and a const lvalue or a non-const rvalue of either type...
Definition: comparison_common_type_with.hpp:65