TPropertyRef: Make use of symmetrical comparison operators
Makes the interface significantly more flexible.
@@ -58,15 +58,32 @@ public:
return Get();
}
- bool operator==(IProperty* pProperty) const
+ bool operator==(const IProperty* pProperty) const
{
return mpProperty == pProperty;
}
+ bool operator!=(const IProperty* pProperty) const
+ {
+ return !operator==(pProperty);
+ }
- friend bool operator==(IProperty* pLeft, const TPropertyRef& kRight)
+ friend bool operator==(const IProperty* pLeft, const TPropertyRef& kRight)
{
return pLeft == kRight.Property();
}
+ friend bool operator!=(const IProperty* pLeft, const TPropertyRef& kRight)
+ {
+ return !operator==(pLeft, kRight);
+ }
+
+ friend bool operator==(const TPropertyRef& left, const IProperty* right)
+ {
+ return left.Property() == right;
+ }
+ friend bool operator!=(const TPropertyRef& left, const IProperty* right)
+ {
+ return !operator==(left, right);
+ }
};
/** Convenience typedefs */
