diff --git a/include/boost/histogram/detail/axes.hpp b/include/boost/histogram/detail/axes.hpp index 87854384..a34d159e 100644 --- a/include/boost/histogram/detail/axes.hpp +++ b/include/boost/histogram/detail/axes.hpp @@ -25,13 +25,10 @@ namespace histogram { namespace detail { template -constexpr bool axes_equal(const std::tuple&, const std::tuple&) { - return false; -} - -template -constexpr bool axes_equal(const std::tuple& t, const std::tuple& u) { - return t == u; +bool axes_equal(const std::tuple& t, const std::tuple& u) { + return static_if, mp11::mp_list>>( + [](const auto& a, const auto& b) { return a == b; }, + [](const auto&, const auto&) { return false; }, t, u); } template @@ -374,15 +371,17 @@ void fill_impl(mp11::mp_int<-1>, S& storage, const A& axes, } template -using weight_index = mp11::mp_if< - is_weight>, mp11::mp_int<0>, - mp11::mp_if>, mp11::mp_int<(mp11::mp_size::value - 1)>, - mp11::mp_int<-1>>>; +constexpr int weight_index() { + const int n = mp11::mp_size::value - 1; + if (is_weight>::value) return 0; + if (is_weight>::value) return n; + return -1; +} // generic entry point which analyses args and calls specific -template -void fill_impl(S& s, const T& axes, const std::tuple& args) { - fill_impl(weight_index>(), s, axes, args); +template +void fill_impl(S& s, const T& axes, const U& args) { + fill_impl(mp11::mp_int>()>(), s, axes, args); } /* In all at_impl, we throw instead of asserting when an index is out of diff --git a/include/boost/histogram/ostream_operators.hpp b/include/boost/histogram/ostream_operators.hpp index 85b31ea5..833a25b3 100644 --- a/include/boost/histogram/ostream_operators.hpp +++ b/include/boost/histogram/ostream_operators.hpp @@ -18,7 +18,6 @@ namespace histogram { template std::basic_ostream& operator<<(std::basic_ostream& os, const histogram& h) { - using OS = std::basic_ostream; os << "histogram("; h.for_each_axis([&](const auto& a) { os << "\n " << a << ","; }); os << (h.rank() ? "\n)" : ")");