This is what I got by goole:
Single* obtain_single()
{
void* p = get_system_pool();
byte_t* i = static_cast(p);
if (*(i-1) == 0)
{
Single* s = new(p) Single;
return s;
}
return static_cast(p);
}
Basically, It's the same with using static data member except using the "
get_system_pool()" to count how many objects have been instantiated....
Anyone knows what this function is? Or how to code it? Or any better
methods to do the singleton?