diff options
Diffstat (limited to 'cpp/include/IceUtil/Handle.h')
-rw-r--r-- | cpp/include/IceUtil/Handle.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h index 0f48e2ee71b..df233134548 100644 --- a/cpp/include/IceUtil/Handle.h +++ b/cpp/include/IceUtil/Handle.h @@ -107,16 +107,7 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs) template<typename T, typename U> inline bool operator!=(const HandleBase<T>& lhs, const HandleBase<U>& rhs) { - T* l = lhs.get(); - U* r = rhs.get(); - if(l && r) - { - return *l != *r; - } - else - { - return l || r; - } + return !operator==(lhs, rhs); } template<typename T, typename U> @@ -134,6 +125,24 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs) } } +template<typename T, typename U> +inline bool operator<=(const HandleBase<T>& lhs, const HandleBase<U>& rhs) +{ + return lhs < rhs || lhs == rhs; +} + +template<typename T, typename U> +inline bool operator>(const HandleBase<T>& lhs, const HandleBase<U>& rhs) +{ + return !(lhs < rhs || lhs == rhs); +} + +template<typename T, typename U> +inline bool operator>=(const HandleBase<T>& lhs, const HandleBase<U>& rhs) +{ + return !(lhs < rhs); +} + template<typename T> class Handle : public HandleBase<T> { |