30 template <
typename TObj>
34 static void addRef(TObj* pObj) {
if (pObj) pObj->addRef(); }
35 static void release(TObj* pObj) {
if (pObj) pObj->release(); }
41 template <
typename TObj>
46 static void release(TObj* pObj) {
delete pObj; }
52 template <
typename TObj>
57 static void release(TObj* pObj) {
delete []pObj; }
74 template <
typename TObj,
typename THelper = TObjRelease<TObj> >
82 THelper::addRef(pObj);
83 THelper::release(
m_obj);
92 THelper::addRef(
m_obj);
94 TPtr(
const TObj* pObj,
bool bAttach =
false) :
m_obj(const_cast<TObj*>(pObj))
97 THelper::addRef(
m_obj);
101 THelper::release(
m_obj);
133 operator const TObj *()
const
139 THelper::release(
m_obj);
155 THelper::release(
m_obj);
static void release(TObj *pObj)
static void addRef(TObj *pObj)
static void release(TObj *pObj)
static void addRef(TObj *pObj)
static void release(TObj *pObj)
static void addRef(TObj *pObj)
TPtr & operator=(TObj *pObj)
TPtr & replace(TObj *pObj)
TPtr(const TObj *pObj, bool bAttach=false)