initial work on linker

This commit is contained in:
georgemoralis 2023-05-23 07:48:25 +03:00
parent 76987fb932
commit a09e2eb65a
4 changed files with 68 additions and 1 deletions

27
src/Util/Singleton.h Normal file
View file

@ -0,0 +1,27 @@
#pragma once
#include <cstdlib>
#include <new>
template <class T>
class Singleton
{
public:
static T* Instance()
{
if (!m_instance)
{
m_instance = static_cast<T*>(std::malloc(sizeof(T)));
new (m_instance) T;
}
return m_instance;
}
protected:
Singleton();
~Singleton();
private:
static inline T* m_instance = nullptr;
};