mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-30 19:53:46 +00:00
30 lines
418 B
C++
30 lines
418 B
C++
class RefCountedBase {
|
|
protected:
|
|
bool derefBase()
|
|
{
|
|
return true;
|
|
}
|
|
};
|
|
|
|
template<typename T> class RefCounted : public RefCountedBase {
|
|
public:
|
|
void deref()
|
|
{
|
|
if (derefBase())
|
|
delete static_cast<T*>(this);
|
|
}
|
|
|
|
protected:
|
|
// RefCounted() { }
|
|
~RefCounted()
|
|
{
|
|
}
|
|
};
|
|
|
|
|
|
class Event : public RefCounted<Event> {
|
|
public:
|
|
Event();
|
|
virtual ~Event();
|
|
};
|