Eliminate span_internal::Min in favor of std::min, since Min conflicts with a macro in a third-party library.

PiperOrigin-RevId: 485653193
Change-Id: I0615ceb9ea3e1533a989470e7c9863c86b70698b
pull/1307/head
Jorg Brown 2 years ago committed by Copybara-Service
parent a87df8e9db
commit 1649c037c5
  1. 3
      absl/types/internal/span.h
  2. 2
      absl/types/span.h

@ -32,9 +32,6 @@ template <typename T>
class Span; class Span;
namespace span_internal { namespace span_internal {
// A constexpr min function
constexpr size_t Min(size_t a, size_t b) noexcept { return a < b ? a : b; }
// Wrappers for access to container data pointers. // Wrappers for access to container data pointers.
template <typename C> template <typename C>
constexpr auto GetDataImpl(C& c, char) noexcept // NOLINT(runtime/references) constexpr auto GetDataImpl(C& c, char) noexcept // NOLINT(runtime/references)

@ -420,7 +420,7 @@ class Span {
// absl::MakeSpan(vec).subspan(5); // throws std::out_of_range // absl::MakeSpan(vec).subspan(5); // throws std::out_of_range
constexpr Span subspan(size_type pos = 0, size_type len = npos) const { constexpr Span subspan(size_type pos = 0, size_type len = npos) const {
return (pos <= size()) return (pos <= size())
? Span(data() + pos, span_internal::Min(size() - pos, len)) ? Span(data() + pos, (std::min)(size() - pos, len))
: (base_internal::ThrowStdOutOfRange("pos > size()"), Span()); : (base_internal::ThrowStdOutOfRange("pos > size()"), Span());
} }

Loading…
Cancel
Save