diff options
Diffstat (limited to 'utils/logval.h')
-rw-r--r-- | utils/logval.h | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/utils/logval.h b/utils/logval.h index da0aa2b0..6fdc2c42 100644 --- a/utils/logval.h +++ b/utils/logval.h @@ -201,6 +201,16 @@ LogVal<T> pow(const LogVal<T>& b, const T& e) { } template <class T> +bool operator==(const LogVal<T>& lhs, const LogVal<T>& rhs) { + return (lhs.v_ == rhs.v_) && (lhs.s_ == rhs.s_); +} + +template <class T> +bool operator!=(const LogVal<T>& lhs, const LogVal<T>& rhs) { + return !(lhs == rhs); +} + +template <class T> bool operator<(const LogVal<T>& lhs, const LogVal<T>& rhs) { if (lhs.s_ == rhs.s_) { return (lhs.v_ < rhs.v_); @@ -209,35 +219,22 @@ bool operator<(const LogVal<T>& lhs, const LogVal<T>& rhs) { } } -#if 0 template <class T> bool operator<=(const LogVal<T>& lhs, const LogVal<T>& rhs) { - return (lhs.v_ <= rhs.v_); + return (lhs < rhs) || (lhs == rhs); } template <class T> bool operator>(const LogVal<T>& lhs, const LogVal<T>& rhs) { - return (lhs.v_ > rhs.v_); + return !(lhs <= rhs); } template <class T> bool operator>=(const LogVal<T>& lhs, const LogVal<T>& rhs) { - return (lhs.v_ >= rhs.v_); + return !(lhs < rhs); } -#endif - template <class T> std::size_t hash_value(const LogVal<T>& x) { return x.hash_impl(); } -template <class T> -bool operator==(const LogVal<T>& lhs, const LogVal<T>& rhs) { - return (lhs.v_ == rhs.v_) && (lhs.s_ == rhs.s_); -} - -template <class T> -bool operator!=(const LogVal<T>& lhs, const LogVal<T>& rhs) { - return !(lhs == rhs); -} - #endif |