diff options
Diffstat (limited to 'cpp/include/Ice/Proxy.h')
-rw-r--r-- | cpp/include/Ice/Proxy.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index e3f8902ea98..8e11ab12492 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -419,6 +419,64 @@ namespace IceInternal { // +// Inline comparison functions for proxies +// +template<typename T, typename U> +inline bool operator==(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + ::IceProxy::Ice::Object* l = upCast(lhs.get()); + ::IceProxy::Ice::Object* r = upCast(rhs.get()); + if(l && r) + { + return *l == *r; + } + else + { + return !l && !r; + } +} + +template<typename T, typename U> +inline bool operator!=(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + return !operator==(lhs, rhs); +} + +template<typename T, typename U> +inline bool operator<(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + ::IceProxy::Ice::Object* l = upCast(lhs.get()); + ::IceProxy::Ice::Object* r = upCast(rhs.get()); + if(l && r) + { + return *l < *r; + } + else + { + return !l && r; + } +} + +template<typename T, typename U> +inline bool operator<=(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + return lhs < rhs || lhs == rhs; +} + +template<typename T, typename U> +inline bool operator>(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + return !(lhs < rhs || lhs == rhs); +} + +template<typename T, typename U> +inline bool operator>=(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs) +{ + return !(lhs < rhs); +} + + +// // checkedCast and uncheckedCast functions without facet: // template<typename P> P |