Skip to content

Instantly share code, notes, and snippets.

Mihai Sebea mihaisebea

Block or report user

Report or block mihaisebea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View singleton_class.cpp
class S
{
public:
static S& GetInstance()
{
static S instance;
return instance;
}
private:
S() {}
View signals.cpp
class Profiler
{
Profiler::Profiler()
public :
void Update()
{
//m_debugger.Update();
sig_Update.emit()
sig_Log.emit("Profiler updating")
}
View no_singletons.cpp
class Profiler
{
Profiler::Profiler(Logger& logger, Debugger& debugger)
: m_logger(logger)
, m_debugger(debugger)
public :
void Update()
{
m_debugger.Update();
logger.Log("Profiler updating")
View singletons.cpp
class Profiler
{
Profiler& GetInstance() { return s_instance; }
public :
void Update()
{
Debugger::GetInstance().Update();
Logger::GetInstance().Log("Profiler updating")
}
};
You can’t perform that action at this time.