VCCC  2024.05
VisualCamp Common C++ library
common_reference_with.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-02.
3 //
4 
5 #ifndef VCCC_CONCEPTS_COMMON_REFERENCE_WITH_HPP_
6 #define VCCC_CONCEPTS_COMMON_REFERENCE_WITH_HPP_
7 
8 #include <type_traits>
9 
15 
16 namespace vccc {
17 namespace detail {
18 
19 template<
20  typename T,
21  typename U,
22  bool = conjunction<
23  has_typename_type<common_reference<T, U>>,
24  has_typename_type<common_reference<U, T>>
25  >::value /* false */
26 >
27 struct common_reference_with_impl : std::false_type {};
28 
29 template<typename T, typename U>
30 struct common_reference_with_impl<T, U, true>
31  : conjunction<
32  same_as< common_reference_t<T, U>, common_reference_t<U, T> >,
33  convertible_to<T, common_reference_t<T, U> >,
34  convertible_to<U, common_reference_t<T, U> >
35  > {};
36 
37 } // namespace detail
38 
41 
53 template<typename T, typename U>
54 struct common_reference_with : detail::common_reference_with_impl<T, U> {};
55 
57 
58 } // namespace vccc
59 
60 #endif // VCCC_CONCEPTS_COMMON_REFERENCE_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 reference type
Definition: common_reference_with.hpp:54