I need a singleton implementation without using dynamic memory allocation. I tried to implement it like this:
// Singleton.hpp
class Singleton
{
    public:
    static Singleton& GetInstance();
    private:
    Singleton();
    static Singleton& Instance;
};
// Singlton.cpp
Singleton& Singleton::GetInstance()
{
    return Singleton::Instance;
}
Singleton::Singleton()
{
}
As I said this doesn't compiles. I read many articles, I tried to initialize static Singleton& Instance in different ways, but all I get is a new compilation errors. Why this doesn't work? And how to implement a singleton pattern without using dynamic memory allocation?
 
     
     
    