Merge bitcoin/bitcoin#29071: refactor: Remove Span operator==, Use std::ranges::equal

fad0cf6f26 refactor: Use std::ranges::equal in GetNetworkForMagic (MarcoFalke)
fadf0a7e15 refactor: Remove Span operator==, Use std::ranges::equal (MarcoFalke)

Pull request description:

  `std::span` removed the comparison operators, so it makes sense to remove them for the `Span` "backport" as well. Using `std::ranges::equal` also has the benefit that some `Span` temporary constructions can now be dropped.

  This is required to move from `Span` toward `std::span`.

ACKs for top commit:
  hodlinator:
    Untested Code Review re-ACK fad0cf6
  stickies-v:
    ACK fad0cf6f26
  TheCharlatan:
    ACK fad0cf6f26

Tree-SHA512: 5b9d1826ceac2aabae2295bc89893dd23ac3a1cc0d41988331cdbdc21be531aa91795d5273819f349f79648c6c4f30ed31af6e7a3816153e92080061b92ffe00
This commit is contained in:
merge-script
2024-08-28 10:34:47 +01:00
21 changed files with 76 additions and 74 deletions

View File

@@ -21,6 +21,7 @@
#include <util/strencodings.h>
#include <util/vector.h>
#include <algorithm>
#include <memory>
#include <numeric>
#include <optional>
@@ -1405,11 +1406,11 @@ std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const S
}
KeyPath path;
DeriveType type = DeriveType::NO;
if (split.back() == Span{"*"}.first(1)) {
if (std::ranges::equal(split.back(), Span{"*"}.first(1))) {
split.pop_back();
type = DeriveType::UNHARDENED;
} else if (split.back() == Span{"*'"}.first(2) || split.back() == Span{"*h"}.first(2)) {
apostrophe = split.back() == Span{"*'"}.first(2);
} else if (std::ranges::equal(split.back(), Span{"*'"}.first(2)) || std::ranges::equal(split.back(), Span{"*h"}.first(2))) {
apostrophe = std::ranges::equal(split.back(), Span{"*'"}.first(2));
split.pop_back();
type = DeriveType::HARDENED;
}