From db873c8dc2ed7cb34a8bf21f8ea098537aacc406 Mon Sep 17 00:00:00 2001 From: sowle Date: Sat, 8 Apr 2023 03:17:21 +0200 Subject: [PATCH] crypto: more of point_t::operator== and != --- src/crypto/crypto-sugar.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto-sugar.h b/src/crypto/crypto-sugar.h index 1160859e..2f4e4776 100644 --- a/src/crypto/crypto-sugar.h +++ b/src/crypto/crypto-sugar.h @@ -815,12 +815,32 @@ namespace crypto return false; return true; - }; + } friend bool operator!=(const point_t& lhs, const point_t& rhs) { return !(lhs == rhs); - }; + } + + friend bool operator==(const point_t& lhs, const public_key& rhs) + { + return lhs.to_public_key() == rhs; + } + + friend bool operator!=(const point_t& lhs, const public_key& rhs) + { + return !(lhs == rhs); + } + + friend bool operator==(const public_key& lhs, const point_t& rhs) + { + return lhs == rhs.to_public_key(); + } + + friend bool operator!=(const public_key& lhs, const point_t& rhs) + { + return !(lhs == rhs); + } friend std::ostream& operator<<(std::ostream& ss, const point_t &v) {