//TTSPtr - [2020-04-13 11:57:47] #ifndef _TTSPTR_H_ #define _TTSPTR_H_ #include "common.h" /* 0016779E TTSPtr::TTSPtr() 001677BE TTSPtr::TTSPtr(TNMVert*) 00166E50 TTSPtr::~TTSPtr() 00167840 TTSPtr::operator=(TTSPtr const&) 00168AFC TTSPtr::Release() struct TNMVert { int field_0; int field_4; }; TTSPtr 智能指针 外部指针不能重复绑定,否则会崩溃 */ template class TTSPtr { public: //0016779E TTSPtr() { pT_0 = 0; pRef_4 = new int; *pRef_4 = 0; ++(*pRef_4); }; //------------------------------------------------------------------------------------------------- //001677BE TTSPtr(T *pNode) { pT_0 = pNode; pRef_4 = new int; *pRef_4 = 0; ++(*pRef_4); }; //------------------------------------------------------------------------------------------------- //00166E50 TTSPtr_TNMVert ~TTSPtr() { int dr1 = *pRef_4; dr1--; *pRef_4 = dr1; if (dr1 == 0) { if (pT_0) delete pT_0; //loc_166E66 if (pRef_4) delete pRef_4; } //loc_166E6E }; //------------------------------------------------------------------------------------------------- //00167840 TTSPtr &operator=(TTSPtr const &other) { if (this != &other) { --(*pRef_4); if (*pRef_4 == 0) { if (pT_0) delete pT_0; if (pRef_4) delete pRef_4; } //loc_167864 this->pT_0 = other.pT_0; this->pRef_4 = other.pRef_4; ++(*other.pRef_4); } //loc_167872 return *this; }; //------------------------------------------------------------------------------------------------- inline bool operator==(TTSPtr const &other) { //合理的猜测这个函数是被inline if (pT_0 == other.pT_0) { return true; } return false; } //------------------------------------------------------------------------------------------------- //00168AFC void Release() { --(*pRef_4); if (*pRef_4 == 0) { if (pT_0) delete pT_0; if (pRef_4) delete pRef_4; } //loc_168B1A pT_0 = nullptr; pRef_4 = new int; *pRef_4 = 0; ++(*pRef_4); }; //------------------------------------------------------------------------------------------------- T *pT_0; int *pRef_4; }; #endif //_TTSPTR_H_