Remove span comparisons operators

Chromium's base::span removed these operators ~5 years ago in
https://crrev.com/608702, so remove them from pdfium::span as well.
Similarly convert existing usages to their STL algorithm equivalents.

Bug: pdfium:2085
Change-Id: I9f4b9ac589f71479d8eeecf21e3fde13c9ddf77c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112590
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp b/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp
index eef91f7..4821dc5 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc_unittest.cpp
@@ -4,6 +4,7 @@
 
 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
 
+#include <algorithm>
 #include <utility>
 
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
@@ -31,5 +32,7 @@
   auto stream_acc = pdfium::MakeRetain<CPDF_StreamAcc>(stream);
   stream_acc->LoadAllDataRaw();
   stream.Reset();
-  EXPECT_EQ(pdfium::make_span(kData), stream_acc->GetSpan());
+  auto span = stream_acc->GetSpan();
+  EXPECT_TRUE(
+      std::equal(std::begin(kData), std::end(kData), span.begin(), span.end()));
 }
diff --git a/core/fxcrt/bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index 2fc83bd..6411d9b 100644
--- a/core/fxcrt/bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -1520,7 +1520,9 @@
 
   pdfium::span<const uint8_t> span5(
       pdfium::as_bytes(pdfium::make_span("hello", 5u)));
-  EXPECT_EQ(byte_string_c.raw_span(), span5);
+  auto raw_span = byte_string_c.raw_span();
+  EXPECT_TRUE(
+      std::equal(raw_span.begin(), raw_span.end(), span5.begin(), span5.end()));
 }
 
 TEST(ByteStringView, OperatorNE) {
diff --git a/core/fxcrt/string_view_template.h b/core/fxcrt/string_view_template.h
index 628bb79..069b803 100644
--- a/core/fxcrt/string_view_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -101,7 +101,8 @@
   }
 
   bool operator==(const StringViewTemplate& other) const {
-    return m_Span == other.m_Span;
+    return std::equal(m_Span.begin(), m_Span.end(), other.m_Span.begin(),
+                      other.m_Span.end());
   }
   bool operator==(const CharType* ptr) const {
     StringViewTemplate other(ptr);
diff --git a/third_party/base/containers/span.h b/third_party/base/containers/span.h
index 0d600c3..00a2324 100644
--- a/third_party/base/containers/span.h
+++ b/third_party/base/containers/span.h
@@ -309,40 +309,6 @@
   size_t size_ = 0;
 };
 
-// [span.comparison], span comparison operators
-// Relational operators. Equality is a element-wise comparison.
-template <typename T>
-constexpr bool operator==(span<T> lhs, span<T> rhs) noexcept {
-  return lhs.size() == rhs.size() &&
-         std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin());
-}
-
-template <typename T>
-constexpr bool operator!=(span<T> lhs, span<T> rhs) noexcept {
-  return !(lhs == rhs);
-}
-
-template <typename T>
-constexpr bool operator<(span<T> lhs, span<T> rhs) noexcept {
-  return std::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(),
-                                      rhs.cend());
-}
-
-template <typename T>
-constexpr bool operator<=(span<T> lhs, span<T> rhs) noexcept {
-  return !(rhs < lhs);
-}
-
-template <typename T>
-constexpr bool operator>(span<T> lhs, span<T> rhs) noexcept {
-  return rhs < lhs;
-}
-
-template <typename T>
-constexpr bool operator>=(span<T> lhs, span<T> rhs) noexcept {
-  return !(lhs < rhs);
-}
-
 // [span.objectrep], views of object representation
 template <typename T>
 span<const uint8_t> as_bytes(span<T> s) noexcept {