From 9b8c712a8110d5bafa96c0fcdddecfd15c0b8e27 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 16 Nov 2010 16:58:40 +0000 Subject: [PATCH] added operator != for some basic structures (ticket #678) --- modules/core/include/opencv2/core/operations.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index e31d619..3877ad2 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -1273,6 +1273,10 @@ bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b) { return a.re == b.re && a.im == b.im; } template static inline +bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b) +{ return a.re != b.re || a.im != b.im; } + +template static inline Complex<_Tp> operator + (const Complex<_Tp>& a, const Complex<_Tp>& b) { return Complex<_Tp>( a.re + b.re, a.im + b.im ); } @@ -1444,7 +1448,7 @@ template static inline bool operator == (const Point_<_Tp>& a, con { return a.x == b.x && a.y == b.y; } template static inline bool operator != (const Point_<_Tp>& a, const Point_<_Tp>& b) -{ return !(a == b); } +{ return a.x != b.x || a.y != b.y; } template static inline Point_<_Tp> operator + (const Point_<_Tp>& a, const Point_<_Tp>& b) { return Point_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y) ); } @@ -1556,6 +1560,9 @@ template static inline double norm(const Point3_<_Tp>& pt) template static inline bool operator == (const Point3_<_Tp>& a, const Point3_<_Tp>& b) { return a.x == b.x && a.y == b.y && a.z == b.z; } +template static inline bool operator != (const Point3_<_Tp>& a, const Point3_<_Tp>& b) +{ return a.x != b.x || a.y != b.y || a.z != b.z; } + template static inline Point3_<_Tp> operator + (const Point3_<_Tp>& a, const Point3_<_Tp>& b) { return Point3_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y), @@ -1711,6 +1718,11 @@ template static inline bool operator == (const Rect_<_Tp>& a, cons return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; } +template static inline bool operator != (const Rect_<_Tp>& a, const Rect_<_Tp>& b) +{ + return a.x != b.x || a.y != b.y || a.width != b.width || a.height != b.height; +} + template static inline Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Point_<_Tp>& b) { return Rect_<_Tp>( a.x + b.x, a.y + b.y, a.width, a.height ); -- 2.7.4