kylin-printer/common/singleton.h

19 lines
313 B
C++

#pragma once
template<typename T>
class Singleton {
public:
static T& instance() {
static T instance;
return instance;
}
protected:
Singleton() {}
virtual ~Singleton() {}
private:
Singleton(const Singleton&) = delete;
Singleton& operator= (const Singleton) = delete;
};