diff --git a/include/boost/histogram/detail/axes.hpp b/include/boost/histogram/detail/axes.hpp index 1aee9c6a..44b7486b 100644 --- a/include/boost/histogram/detail/axes.hpp +++ b/include/boost/histogram/detail/axes.hpp @@ -236,7 +236,7 @@ bool axes_equal_impl(const T& t, const U& u, mp11::index_sequence) noexce template bool axes_equal_impl(const std::tuple& t, const std::tuple& u) noexcept { return axes_equal_impl( - t, u, mp11::make_index_sequence{}); + t, u, mp11::make_index_sequence<(std::min)(sizeof...(Ts), sizeof...(Us))>{}); } template diff --git a/include/boost/histogram/detail/fill.hpp b/include/boost/histogram/detail/fill.hpp index e7859425..9b8038f9 100644 --- a/include/boost/histogram/detail/fill.hpp +++ b/include/boost/histogram/detail/fill.hpp @@ -229,7 +229,7 @@ struct linearize_args { }; template -constexpr unsigned min(const unsigned n) noexcept { +constexpr unsigned(min)(const unsigned n) noexcept { constexpr unsigned a = buffer_size::value; return a < n ? a : n; } diff --git a/include/boost/histogram/detail/fill_n.hpp b/include/boost/histogram/detail/fill_n.hpp index 520b301e..d1b55a27 100644 --- a/include/boost/histogram/detail/fill_n.hpp +++ b/include/boost/histogram/detail/fill_n.hpp @@ -218,7 +218,7 @@ void fill_n_nd(const std::size_t offset, S& storage, A& axes, const std::size_t */ for (std::size_t start = 0; start < vsize; start += buffer_size) { - const std::size_t n = std::min(buffer_size, vsize - start); + const std::size_t n = (std::min)(buffer_size, vsize - start); // fill buffer of indices... fill_n_indices(indices, start, n, offset, storage, axes, values); // ...and fill corresponding storage cells diff --git a/include/boost/histogram/indexed.hpp b/include/boost/histogram/indexed.hpp index c636abf5..66690e60 100644 --- a/include/boost/histogram/indexed.hpp +++ b/include/boost/histogram/indexed.hpp @@ -334,8 +334,8 @@ public: constexpr axis::index_type start = opt::test(axis::option::underflow) ? -1 : 0; const auto stop = size + (opt::test(axis::option::overflow) ? 1 : 0); - ca->begin = std::max(start, detail::get<0>(*r_begin)); - ca->end = std::min(stop, detail::get<1>(*r_begin)); + ca->begin = (std::max)(start, detail::get<0>(*r_begin)); + ca->end = (std::min)(stop, detail::get<1>(*r_begin)); assert(ca->begin <= ca->end); ca->idx = ca->begin; diff --git a/include/boost/histogram/ostream.hpp b/include/boost/histogram/ostream.hpp index 3a061a94..b96381d7 100644 --- a/include/boost/histogram/ostream.hpp +++ b/include/boost/histogram/ostream.hpp @@ -57,7 +57,7 @@ public: } count_ = 0; os_ << t; - *iter_ = std::max(*iter_, static_cast(count_)); + *iter_ = (std::max)(*iter_, static_cast(count_)); } else { assert(iter_ != end()); os_ << std::setw(*iter_) << t; @@ -109,7 +109,7 @@ void ostream_value_impl(OStream& os, const T& t, decltype(static_cast(t), priority<1>{})) { // a value from histogram cell const auto d = static_cast(t); - if (std::numeric_limits::min() <= d && d <= std::numeric_limits::max()) { + if ((std::numeric_limits::min)() <= d && d <= (std::numeric_limits::max)()) { const auto i = static_cast(d); if (i == d) { os << i; @@ -167,7 +167,7 @@ void ostream_bin(OStream& os, const Axis&, axis::index_type i, B, priority<0>) { struct line { const char* ch; const int size; - line(const char* a, int b) : ch{a}, size{std::max(b, 0)} {} + line(const char* a, int b) : ch{a}, size{(std::max)(b, 0)} {} }; template @@ -243,8 +243,8 @@ void plot(OStream& os, const Histogram& h, int w_total, std::true_type) { for (auto&& v : indexed(h, coverage::all)) { auto w = static_cast(*v); ostream_head(tos.row(), ax, v.index(), w); - vmin = std::min(vmin, w); - vmax = std::max(vmax, w); + vmin = (std::min)(vmin, w); + vmax = (std::max)(vmax, w); } tos.complete(); if (vmax == 0) vmax = 1; @@ -300,7 +300,7 @@ void ostream(OStream& os, const Histogram& h, const bool show_values = true) { tos.complete(); const int w_item = std::accumulate(tos.begin(), tos.end(), 0) + 4 + h.rank(); - const int nrow = std::max(1, 65 / w_item); + const int nrow = (std::max)(1, 65 / w_item); int irow = 0; for (auto&& v : indexed(h, coverage::all)) { os << (irow == 0 ? "\n (" : " ("); diff --git a/test/histogram_custom_axis_test.cpp b/test/histogram_custom_axis_test.cpp index 7a29e408..3cfa4615 100644 --- a/test/histogram_custom_axis_test.cpp +++ b/test/histogram_custom_axis_test.cpp @@ -48,7 +48,7 @@ public: const auto x = std::get<0>(xy); const auto y = std::get<1>(xy); const auto r = std::sqrt(x * x + y * y); - return std::min(static_cast(r), size()); + return (std::min)(static_cast(r), size()); } auto update(std::tuple xy) { diff --git a/test/histogram_fill_test.cpp b/test/histogram_fill_test.cpp index ee3c37b3..d647412f 100644 --- a/test/histogram_fill_test.cpp +++ b/test/histogram_fill_test.cpp @@ -53,7 +53,7 @@ struct axis2d { const auto x = std::get<0>(xy); const auto y = std::get<1>(xy); const auto r = std::sqrt(x * x + y * y); - return std::min(static_cast(r), size()); + return (std::min)(static_cast(r), size()); } friend std::ostream& operator<<(std::ostream& os, const axis2d&) { diff --git a/test/unlimited_storage_test.cpp b/test/unlimited_storage_test.cpp index 9892477b..8e6c274c 100644 --- a/test/unlimited_storage_test.cpp +++ b/test/unlimited_storage_test.cpp @@ -239,11 +239,11 @@ struct adder { // If RHS is normal integer, LHS doesn't change. a[0] += b; // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, - // iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); + // iRHS < 4 ? iLHS : (std::max)(iLHS, iRHS)); BOOST_TEST_EQ(a[0], limits_max()); a[0] += prepare(1, b)[0]; // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, - // iRHS < 4 ? iLHS + 1 : std::max(iLHS, iRHS)); + // iRHS < 4 ? iLHS + 1 : (std::max)(iLHS, iRHS)); BOOST_TEST_EQ(a[0], 2 * double(limits_max())); } }