Smart operators for smart Ptr (feature #2637)
This commit is contained in:
parent
47963f0083
commit
a09b973c2e
@ -1277,12 +1277,13 @@ public:
|
|||||||
operator _Tp* ();
|
operator _Tp* ();
|
||||||
operator const _Tp*() const;
|
operator const _Tp*() const;
|
||||||
|
|
||||||
bool operator==(const Ptr<_Tp>& ptr) const;
|
|
||||||
|
|
||||||
_Tp* obj; //< the object pointer.
|
_Tp* obj; //< the object pointer.
|
||||||
int* refcount; //< the associated reference counter
|
int* refcount; //< the associated reference counter
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T, class U> bool operator==(Ptr<T> const & a, Ptr<U> const & b);
|
||||||
|
template<class T, class U> bool operator!=(Ptr<T> const & a, Ptr<U> const & b);
|
||||||
|
|
||||||
|
|
||||||
//////////////////////// Input/Output Array Arguments /////////////////////////////////
|
//////////////////////// Input/Output Array Arguments /////////////////////////////////
|
||||||
|
|
||||||
|
@ -2691,10 +2691,11 @@ template<typename _Tp> template<typename _Tp2> inline const Ptr<_Tp2> Ptr<_Tp>::
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> inline bool Ptr<_Tp>::operator==(const Ptr<_Tp>& _ptr) const
|
template<class _Tp, class _Tp2> inline bool operator==(const Ptr<_Tp>& a, const Ptr<_Tp2>& b) { return a.refcount == b.refcount; }
|
||||||
{
|
template<class _Tp, class _Tp2> inline bool operator!=(const Ptr<_Tp>& a, const Ptr<_Tp2>& b) { return a.refcount != b.refcount; }
|
||||||
return refcount == _ptr.refcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//// specializied implementations of Ptr::delete_obj() for classic OpenCV types
|
//// specializied implementations of Ptr::delete_obj() for classic OpenCV types
|
||||||
|
|
||||||
|
@ -5519,7 +5519,7 @@ void read( const FileNode& node, SparseMat& mat, const SparseMat& default_mat )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ptr<CvSparseMat> m = (CvSparseMat*)cvRead((CvFileStorage*)node.fs, (CvFileNode*)*node);
|
Ptr<CvSparseMat> m = (CvSparseMat*)cvRead((CvFileStorage*)node.fs, (CvFileNode*)*node);
|
||||||
CV_Assert(CV_IS_SPARSE_MAT(m));
|
CV_Assert(CV_IS_SPARSE_MAT(m.obj));
|
||||||
SparseMat(m).copyTo(mat);
|
SparseMat(m).copyTo(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ void FlannBasedMatcher::write( FileStorage& fs) const
|
|||||||
{
|
{
|
||||||
fs << "indexParams" << "[";
|
fs << "indexParams" << "[";
|
||||||
|
|
||||||
if (indexParams != 0)
|
if (indexParams)
|
||||||
{
|
{
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
std::vector<int> types;
|
std::vector<int> types;
|
||||||
@ -667,7 +667,7 @@ void FlannBasedMatcher::write( FileStorage& fs) const
|
|||||||
|
|
||||||
fs << "]" << "searchParams" << "[";
|
fs << "]" << "searchParams" << "[";
|
||||||
|
|
||||||
if (searchParams != 0)
|
if (searchParams)
|
||||||
{
|
{
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
std::vector<int> types;
|
std::vector<int> types;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user