Implementing *= operator. Implementing * in terms of it.
authorMarc Rollins <mrollins@gravityjack.com>
Mon, 18 Aug 2014 18:42:10 +0000 (11:42 -0700)
committerMarc Rollins <mrollins@gravityjack.com>
Mon, 18 Aug 2014 18:42:10 +0000 (11:42 -0700)
modules/core/include/opencv2/core/types.hpp

index 0b09c6f..43b2d2e 100644 (file)
@@ -1311,11 +1311,19 @@ _Tp Size_<_Tp>::area() const
     return width * height;
 }
 
+template<typename _Tp> static inline
+Size_<_Tp>& operator *= (Size_<_Tp>& a, _Tp b)
+{
+    a.width *= b;
+    a.height *= b;
+    return a;
+}
 
 template<typename _Tp> static inline
-Size_<_Tp> operator * (const Size_<_Tp>& a, _Tp b)
+Size_<_Tp> operator * (Size_<_Tp> a, _Tp b)
 {
-    return Size_<_Tp>(a.width * b, a.height * b);
+    a *= b;
+    return a;
 }
 
 template<typename _Tp> static inline