#include <stdio.h>

template<typename T>
class singleton {
  static T* g_pInstance;
public:
  static T* getInstance() {
  	return g_pInstance;
  }
  singleton() {
  	g_pInstance = (T*)this;
  }
  ~singleton() {
  	if(g_pInstance == this) g_pInstance = nullptr;
  }
};

template<typename T>
T* singleton<T>::g_pInstance = nullptr;

class Any : public singleton<Any> { /* Done */ };

int main() {
  printf("0x%x\n", Any::getInstance());
  return 0;
}
