1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Modernize Hash ordering with C++20 <=>

Progress on #10832

This doesn't switch to auto-deriving the fields, but by defining `<=>`
we allow deriving `<=>` in downstream types where `Hash` is used.
This commit is contained in:
John Ericson 2024-05-16 18:46:38 -04:00
parent d16fcaee21
commit cfc18a7739
2 changed files with 8 additions and 20 deletions

View file

@ -86,19 +86,14 @@ private:
public:
/**
* Check whether two hash are equal.
* Check whether two hashes are equal.
*/
bool operator == (const Hash & h2) const;
/**
* Check whether two hash are not equal.
* Compare how two hashes are ordered.
*/
bool operator != (const Hash & h2) const;
/**
* For sorting.
*/
bool operator < (const Hash & h) const;
std::strong_ordering operator <=> (const Hash & h2) const;
/**
* Returns the length of a base-16 representation of this hash.