Replace manually implemented operator== and operator!= for Key with
compiler-generated defaults. In C++20, comparison operators can be
explicitly defaulted, and the generated behavior is identical to our
hand-crafted implementation.
This simplifies the code by letting the compiler handle operator
generation automatically.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Key(uint64_t offset, const hobject_t &oid) : offset(offset), oid(oid) {};
- friend bool operator==(const Key &lhs, const Key &rhs) {
- return lhs.offset == rhs.offset
- && lhs.oid == rhs.oid;
- }
-
- friend bool operator!=(const Key &lhs, const Key &rhs) {
- return !(lhs == rhs);
- }
+ bool operator==(const Key&) const = default;
};
struct KeyHash {