19 lines
454 B
C++
19 lines
454 B
C++
#ifndef Toolbox_Singleton_H
|
|
#define Toolbox_Singleton_H
|
|
namespace Toolbox {
|
|
template<typename Derived>
|
|
class Singleton {
|
|
public:
|
|
static Derived *instance() {
|
|
static Derived instance;
|
|
return &instance;
|
|
}
|
|
Singleton(const Singleton &) = delete;
|
|
Singleton &operator=(const Singleton &) = delete;
|
|
protected:
|
|
Singleton() = default;
|
|
~Singleton() = default;
|
|
};
|
|
}
|
|
#endif
|