File indexing completed on 2025-01-18 09:38:11
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP
0008 #define BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP
0009
0010 #include <boost/histogram/detail/detect.hpp>
0011 #include <boost/histogram/fwd.hpp>
0012 #include <boost/mp11/list.hpp>
0013 #include <boost/mp11/utility.hpp>
0014 #include <tuple>
0015 #include <type_traits>
0016
0017 namespace boost {
0018 namespace histogram {
0019 namespace detail {
0020
0021 template <class T, class U>
0022 using common_axes = mp11::mp_cond<
0023 is_tuple<T>, T,
0024 is_tuple<U>, U,
0025 is_sequence_of_axis<T>, T,
0026 is_sequence_of_axis<U>, U,
0027 std::true_type, T
0028 >;
0029
0030
0031
0032 template <class Storage>
0033 constexpr std::size_t type_rank() {
0034 using T = typename Storage::value_type;
0035 return !std::is_arithmetic<T>::value * 10000 + std::is_floating_point<T>::value * 100 +
0036 10 * sizeof(T) + 2 * is_array_like<Storage>::value +
0037 is_vector_like<Storage>::value;
0038 ;
0039 }
0040
0041 template <class T, class U>
0042 using common_storage = mp11::mp_if_c<(type_rank<T>() >= type_rank<U>()), T, U>;
0043 }
0044 }
0045 }
0046
0047 #endif