File indexing completed on 2025-12-15 09:52:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_DETAIL_HAS_COMMON_EMBEDDING_HPP
0011 #define BOOST_HANA_DETAIL_HAS_COMMON_EMBEDDING_HPP
0012
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/common.hpp>
0015 #include <boost/hana/core/to.hpp>
0016 #include <boost/hana/detail/void_t.hpp>
0017
0018 #include <type_traits>
0019
0020
0021 namespace boost { namespace hana { namespace detail {
0022 template <template <typename...> class Concept, typename T, typename U, typename = void>
0023 struct has_common_embedding_impl : std::false_type { };
0024
0025 template <template <typename...> class Concept, typename T, typename U>
0026 struct has_common_embedding_impl<Concept, T, U, detail::void_t<
0027 typename common<T, U>::type
0028 >> {
0029 using Common = typename common<T, U>::type;
0030 using type = std::integral_constant<bool,
0031 Concept<T>::value &&
0032 Concept<U>::value &&
0033 Concept<Common>::value &&
0034 is_embedded<T, Common>::value &&
0035 is_embedded<U, Common>::value
0036 >;
0037 };
0038
0039
0040
0041
0042
0043
0044
0045 template <template <typename...> class Concept, typename T, typename U>
0046 using has_common_embedding = typename has_common_embedding_impl<Concept, T, U>::type;
0047
0048 template <template <typename...> class Concept, typename T, typename U>
0049 struct has_nontrivial_common_embedding_impl
0050 : has_common_embedding_impl<Concept, T, U>
0051 { };
0052
0053 template <template <typename...> class Concept, typename T>
0054 struct has_nontrivial_common_embedding_impl<Concept, T, T>
0055 : std::false_type
0056 { };
0057
0058
0059
0060
0061
0062
0063
0064 template <template <typename...> class Concept, typename T, typename U>
0065 using has_nontrivial_common_embedding =
0066 typename has_nontrivial_common_embedding_impl<Concept, T, U>::type;
0067 } }}
0068
0069 #endif