1
我已經使用Luabind將一個類綁定到Lua。我需要確保在課程被破壞或通過myClass = nil
使其空白時正確處置。如何在Lua和C++中正確清理類?
此類添加了自己內部本身的靜態列表如下:
template<typename T>
class component : public componentInterface
{
public:
static std::list<componentInterface *> list;
component() : componentInterface()
{
di::component<T>::list.push_back(this);
}
~component()
{
di::component<T>::list.remove(this);
}
};
當調用析構函數它迅速地從列表中移除。
複製構造函數呢? –
當你在你的問題中說'class'時,你主要是指對象或實例 –
@KarthikT是非常多。 – b28c92e5ff1