mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Simplifying arithmetic and comparison operator implementation.
Implementing + and - in terms of += and -=. Implementing != in terms of ==.
This commit is contained in:
parent
d3d9b538c7
commit
8fc1848918
@ -1341,18 +1341,6 @@ Size_<_Tp> operator / (Size_<_Tp> a, _Tp b)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
|
||||||
Size_<_Tp> operator + (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
|
||||||
{
|
|
||||||
return Size_<_Tp>(a.width + b.width, a.height + b.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
|
||||||
Size_<_Tp> operator - (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
|
||||||
{
|
|
||||||
return Size_<_Tp>(a.width - b.width, a.height - b.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
|
Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
|
||||||
{
|
{
|
||||||
@ -1361,6 +1349,13 @@ Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Size_<_Tp> operator + (Size_<_Tp> a, const Size_<_Tp>& b)
|
||||||
|
{
|
||||||
|
a += b;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
|
Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
|
||||||
{
|
{
|
||||||
@ -1369,6 +1364,13 @@ Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Size_<_Tp> operator - (Size_<_Tp> a, const Size_<_Tp>& b)
|
||||||
|
{
|
||||||
|
a -= b;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
||||||
{
|
{
|
||||||
@ -1378,7 +1380,7 @@ bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
|||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
bool operator != (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
bool operator != (const Size_<_Tp>& a, const Size_<_Tp>& b)
|
||||||
{
|
{
|
||||||
return a.width != b.width || a.height != b.height;
|
return !(a == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user