C++11 Helper Functions
The C++11 mapping includes helper functions to simplify the comparison of shared_ptr
targets:
C++
namespace Ice { template<typename T, typename U> bool targetEqualTo(const T& lhs, const U& rhs); template<typename T, typename U> bool targetLess(const T& lhs, const U& rhs); template<typename T, typename U> bool targetGreater(const T& lhs, const U& rhs); template<typename T, typename U> bool targetLessEqual(const T& lhs, const U& rhs); template<typename T, typename U> bool targetGreaterEqual(const T& lhs, const U& rhs); template<typename T, typename U> bool targetNotEqualTo(const T& lhs, const U& rhs); }
These functions can be used to compare any target types, but the most common use case is comparing proxies:
C++
shared_ptr<Ice::ObjectPrx> p1 = ...; shared_ptr<Ice::ObjectPrx> p2 = ...; if(Ice::targetEqualTo(p1, p2)) { ... }
The helper functions rely on the target's implementation of the standard comparison operators operator==
and operator<
.