#include <iostream>
#include<new>
#include<vector>

class Singleton
{
    private:
        Singleton() = default; 
        ~Singleton() = default; 

    public: 

        Singleton(const Singleton&) = delete;  
        Singleton& operator=(const Singleton&) = delete;

        void* operator new(std::size_t) = delete;
        void* operator new[](std::size_t) = delete;

        void operator delete(void*) = delete;
        void operator delete[](void*) = delete;

        static const Singleton& getInstance()
        {
            static Singleton mySingleton;

            return mySingleton; 
        }
        
        void foo() const
        {
        	std::cout << this;
        }
};


int main(int argc, const char *argv[])
{
    const Singleton& s1 = Singleton::getInstance(); 

    // Why does this compile?
    std::vector<Singleton> v(2);
    
    v.front().foo();

    return 0;
}