refactor: Remove Span operator==, Use std::ranges::equal

This commit is contained in:
MarcoFalke
2023-12-13 12:24:21 +01:00
parent 1873e4116f
commit fadf0a7e15
20 changed files with 71 additions and 69 deletions

View File

@ -5,11 +5,11 @@
#ifndef BITCOIN_SPAN_H
#define BITCOIN_SPAN_H
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <span>
#include <type_traits>
#include <utility>
#ifdef DEBUG
#define CONSTEXPR_IF_NOT_DEBUG
@ -213,13 +213,6 @@ public:
return Span<C>(m_data + m_size - count, count);
}
friend constexpr bool operator==(const Span& a, const Span& b) noexcept { return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin()); }
friend constexpr bool operator!=(const Span& a, const Span& b) noexcept { return !(a == b); }
friend constexpr bool operator<(const Span& a, const Span& b) noexcept { return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()); }
friend constexpr bool operator<=(const Span& a, const Span& b) noexcept { return !(b < a); }
friend constexpr bool operator>(const Span& a, const Span& b) noexcept { return (b < a); }
friend constexpr bool operator>=(const Span& a, const Span& b) noexcept { return !(a < b); }
template <typename O> friend class Span;
};