added explicit Mat_<T>::Mat_(const MatExpr&) (resolves ticket #996)

pull/13383/head
Vadim Pisarevsky 14 years ago
parent 5d047af005
commit c5088ca1b8
  1. 6
      modules/core/include/opencv2/core/core.hpp
  2. 6
      modules/core/include/opencv2/core/mat.hpp

@ -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.

@ -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);

Loading…
Cancel
Save