Smart operators for smart Ptr (feature #2637)
This commit is contained in:
@@ -1277,12 +1277,13 @@ public:
|
||||
operator _Tp* ();
|
||||
operator const _Tp*() const;
|
||||
|
||||
bool operator==(const Ptr<_Tp>& ptr) const;
|
||||
|
||||
_Tp* obj; //< the object pointer.
|
||||
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 /////////////////////////////////
|
||||
|
||||
|
||||
@@ -2691,10 +2691,11 @@ template<typename _Tp> template<typename _Tp2> inline const Ptr<_Tp2> Ptr<_Tp>::
|
||||
return p;
|
||||
}
|
||||
|
||||
template<typename _Tp> inline bool Ptr<_Tp>::operator==(const Ptr<_Tp>& _ptr) const
|
||||
{
|
||||
return refcount == _ptr.refcount;
|
||||
}
|
||||
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; }
|
||||
|
||||
|
||||
|
||||
|
||||
//// specializied implementations of Ptr::delete_obj() for classic OpenCV types
|
||||
|
||||
|
||||
Reference in New Issue
Block a user