{
if (_Ptr != _Myptr)
{
if(_Myptr)
_Deleter::delete_ptr(_Myptr);
_Myptr = _Ptr;
}
return *this;
}
smart_ptr<_Ty, _Deleter>& reset(smart_ptr<_Ty, _Deleter>& _Right)
{
if (this != &_Right)
reset(_Right.release());
return *this;
}
_Ty* release()
{
_Ty* _Ptr = _Myptr;
_Myptr = 0;
return _Ptr;
}
smart_ptr<_Ty, _Deleter>& operator = (_Ty* _Ptr) {return reset(_Ptr);}
smart_ptr<_Ty, _Deleter>& operator = (smart_ptr<_Ty, _Deleter>& _Right) {return reset(_Right);}
bool is_valid () const {return _Myptr != 0;}
_Ty& operator * () const {return *_Myptr;}
_Ty* get () const {return _Myptr;}
_Ty* operator -> () const {return _Myptr;}
operator _Ty* () const {return _Myptr;}
private:
template
template
template
template
template
template
protected:
_Ty* _Myptr;
};
/************************************************************************/
/* smart_simple_ptr 单实体智能指针 */
/************************************************************************/
template
class smart_simple_ptr : public smart_ptr<_Ty, simple_deleter<_Ty>>
{
public:
smart_simple_ptr(_Ty* _Ptr = 0) : smart_ptr(_Ptr) {}
smart_simple_ptr(smart_simple_ptr<_Ty>& _Right) : smart_ptr(_Right) {}
smart_simple_ptr(smart_ptr<_Ty, simple_deleter<_Ty>>& _Right) : smart_ptr(_Right) {}
smart_simple_ptr<_Ty>& operator = (smart_ptr<_Ty, simple_deleter<_Ty>>& _Right)
{return (smart_simple_ptr<_Ty>&)__super::operator = (_Right);}
smart_simple_ptr<_Ty>& operator = (smart_simple_ptr<_Ty>& _Right)
{return (smart_simple_ptr<_Ty>&)__super::operator = (_Right);}
smart_simple_ptr<_Ty>& operator = (_Ty* _Ptr)
{return (smart_simple_ptr<_Ty>&)__super::operator = (_Ptr);}
private:
template
template
template
template
};
/************************************************************************/
/* smart_gd_simple_ptr 单实体智能指针 (使用全局 delete) */
/************************************************************************/
template
class smart_gd_simple_ptr : public smart_ptr<_Ty, global_simple_deleter<_Ty>>
{
public:
smart_gd_simple_ptr(_Ty* _Ptr = 0) : smart_ptr(_Ptr) {}
smart_gd_simple_ptr(smart_gd_simple_ptr<_Ty>& _Right) : smart_ptr(_Right) {}
smart_gd_simple_ptr(smart_ptr<_Ty, global_simple_deleter<_Ty>>& _Right) : smart_ptr(_Right) {}
smart_gd_simple_ptr<_Ty>& operator = (smart_ptr<_Ty, global_simple_deleter<_Ty>>& _Right)
{return (smart_gd_simple_ptr<_Ty>&)__super::operator = (_Right);}
smart_gd_simple_ptr<_Ty>& operator = (smart_gd_simple_ptr<_Ty>& _Right)
{return (smart_gd_simple_ptr<_Ty>&)__super::operator = (_Right);}
smart_gd_simple_ptr