Answers for "smart pointer"

C++
0

smart pointer

//SINGLETON - UNIQUE_PTR
#include <memory>
class Singleton
{
	Singleton();
public:
	static std::unique_ptr<Singleton>& Instance() //Public or private
	{
		static std::unique_ptr<Singleton> singleton {new Singleton()}
		return singleton;
	}
};
Posted by: Guest on February-13-2022

Browse Popular Code Answers by Language