#pragma once

#include <vector>



class SingletonBase
{
	friend class SingletonManager;	//forditott sorrendu torlesert felelos
public:
	virtual ~SingletonBase() {};

	static void AddToList(SingletonBase* pSingleton)
	{
		m_Singletons.push_back(pSingleton);
	}

private:
	static std::vector<SingletonBase*> m_Singletons;
};


template <class t>
class Singleton : virtual private SingletonBase
{
public:

	Singleton()
	{

	}


	static t* Instance()
	{
		if(!m_pInstance)
		{
			m_pInstance=new t;
			AddToList(m_pInstance);
		}

		return m_pInstance;
	}


private:
	static t* m_pInstance;
};


template<class t> t* Singleton<t>::m_pInstance=0;
