added explicit Mat_<T>::Mat_(const MatExpr&) (resolves ticket #996)
authorVadim Pisarevsky <no@email>
Sun, 19 Jun 2011 21:13:32 +0000 (21:13 +0000)
committerVadim Pisarevsky <no@email>
Sun, 19 Jun 2011 21:13:32 +0000 (21:13 +0000)
modules/core/include/opencv2/core/core.hpp
modules/core/include/opencv2/core/mat.hpp

index 2c14772..dc75f4d 100644 (file)
@@ -2535,6 +2535,8 @@ public:
     Mat_(const Mat_& m, const Rect& roi);
     //! selects a submatrix, n-dim version
     Mat_(const Mat_& m, const Range* ranges);
+    //! from a matrix expression
+    explicit Mat_(const MatExpr& e);
     //! makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column
     explicit Mat_(const vector<_Tp>& vec, bool copyData=false);
     template<int n> explicit Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData=true);
@@ -2547,6 +2549,8 @@ public:
     Mat_& operator = (const Mat_& m);
     //! set all the elements to s.
     Mat_& operator = (const _Tp& s);
+    //! assign a matrix expression
+    Mat_& operator = (const MatExpr& e);
 
     //! iterators; they are smart enough to skip gaps in the end of rows
     iterator begin();
@@ -2562,8 +2566,6 @@ public:
     void create(int _ndims, const int* _sizes);
     //! cross-product
     Mat_ cross(const Mat_& m) const;
-    //! to support complex matrix expressions
-    Mat_& operator = (const MatExpr& expr);
     //! data type conversion
     template<typename T2> operator Mat_<T2>() const;
     //! overridden forms of Mat::row() etc.
index d4300c7..a696738 100644 (file)
@@ -892,7 +892,6 @@ template<typename _Tp> inline Mat_<_Tp>& Mat_<_Tp>::operator = (const _Tp& s)
     Mat::operator=(Scalar((const VT&)s));
     return *this;
 }
-    
 
 template<typename _Tp> inline void Mat_<_Tp>::create(int _rows, int _cols)
 {
@@ -1335,6 +1334,11 @@ inline Mat& Mat::operator = (const MatExpr& e)
     return *this;
 }    
 
+template<typename _Tp> inline Mat_<_Tp>::Mat_(const MatExpr& e)
+{
+    e.op->assign(e, *this, DataType<_Tp>::type);
+}
+
 template<typename _Tp> Mat_<_Tp>& Mat_<_Tp>::operator = (const MatExpr& e)
 {
     e.op->assign(e, *this, DataType<_Tp>::type);