//the implementation is not mine, but game gems...
#ifndef WJO_SINGELTON_H
#define WJO_SINGELTON_H
template <typename T> class Singleton
{
    static T* ms_Singleton;

public:
    Singleton( void )
    {
        int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;
        ms_Singleton = (T*)((int)this + offset);
    }
   ~Singleton( void )
	{  ms_Singleton = 0;  }
    static T& GetSingleton( void )
        {   return ( *ms_Singleton );  }
    static T* GetSingletonPtr( void )
        {  return ( ms_Singleton );  }
};

template <typename T> T* Singleton <T>::ms_Singleton = 0;
#endif