From 9eb487f8800bcbb00007b26d22331e4eccd674a0 Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Mon, 13 Aug 2018 15:16:10 +0200 Subject: [PATCH] fix ambiguity found by msvc --- include/boost/histogram/detail/axes.hpp | 22 +++++++++++----------- include/boost/histogram/histogram.hpp | 16 ++++++++-------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/boost/histogram/detail/axes.hpp b/include/boost/histogram/detail/axes.hpp index bbf2bd07..6e0c76b6 100644 --- a/include/boost/histogram/detail/axes.hpp +++ b/include/boost/histogram/detail/axes.hpp @@ -154,39 +154,39 @@ void range_check(const static_axes&) { namespace { template -struct at_impl {}; +struct axis_at_impl {}; template -struct at_impl> { +struct axis_at_impl> { using type = mp11::mp_at_c, N>; }; template -struct at_impl> { +struct axis_at_impl> { using type = axis::any; }; } template -using at = typename at_impl::type; +using axis_at = typename axis_at_impl::type; template -auto get(static_axes& axes) -> at>& { +auto axis_get(static_axes& axes) -> axis_at>& { return std::get(axes); } template -auto get(const static_axes& axes) -> const at>& { +auto axis_get(const static_axes& axes) -> const axis_at>& { return std::get(axes); } template -axis::any& get(dynamic_axes& axes) { +axis::any& axis_get(dynamic_axes& axes) { return axes[N]; } template -const axis::any& get(const dynamic_axes& axes) { +const axis::any& axis_get(const dynamic_axes& axes) { return axes[N]; } @@ -354,7 +354,7 @@ void indices_to_index(optional_index&, const Axes&) noexcept {} template void indices_to_index(optional_index& idx, const Axes& axes, const int j, const Us... us) { - const auto& a = ::boost::histogram::detail::get(axes); + const auto& a = axis_get(axes); const auto a_size = a.size(); const auto a_shape = a.shape(); idx.stride *= (-1 <= j && j <= a_size); // set to 0, if j is invalid @@ -398,7 +398,7 @@ template void indices_to_index_get(mp11::mp_size_t, optional_index& idx, const Axes& axes, const T& t) { constexpr std::size_t D = mp_size() - N; - const auto& a = ::boost::histogram::detail::get(axes); + const auto& a = axis_get(axes); const auto a_size = a.size(); const auto a_shape = a.shape(); const auto j = static_cast(std::get(t)); @@ -428,7 +428,7 @@ template void args_to_index_iter(mp11::mp_size_t, optional_index& idx, const static_axes& axes, Iterator iter) { constexpr std::size_t D = sizeof...(Ts)-N; - const auto& a = ::boost::histogram::detail::get(axes); + const auto& a = axis_get(axes); const auto a_size = a.size(); const auto a_shape = a.shape(); const int j = a.index(*iter); diff --git a/include/boost/histogram/histogram.hpp b/include/boost/histogram/histogram.hpp index e2dd2ae3..0c1c65dc 100644 --- a/include/boost/histogram/histogram.hpp +++ b/include/boost/histogram/histogram.hpp @@ -111,33 +111,33 @@ public: /// Get N-th axis (const version) template - auto axis(mp11::mp_int) const -> const detail::at& { + auto axis(mp11::mp_int) const -> const detail::axis_at& { detail::range_check(axes_); - return detail::get(axes_); + return detail::axis_get(axes_); } /// Get N-th axis template - auto axis(mp11::mp_int) -> detail::at& { + auto axis(mp11::mp_int) -> detail::axis_at& { detail::range_check(axes_); - return detail::get(axes_); + return detail::axis_get(axes_); } /// Get first axis (convenience for 1-d histograms, const version) - const detail::at<0, axes_type>& axis() const { return axis(mp11::mp_int<0>()); } + const detail::axis_at<0, axes_type>& axis() const { return axis(mp11::mp_int<0>()); } /// Get first axis (convenience for 1-d histograms) - detail::at<0, axes_type>& axis() { return axis(mp11::mp_int<0>()); } + detail::axis_at<0, axes_type>& axis() { return axis(mp11::mp_int<0>()); } /// Get N-th axis with runtime index (const version) template > - const detail::at<0, U>& axis(int i) const { + const detail::axis_at<0, U>& axis(int i) const { return axes_[i]; } /// Get N-th axis with runtime index template > - detail::at<0, U>& axis(int i) { + detail::axis_at<0, U>& axis(int i) { return axes_[i]; }