24 lines
370 B
C++
24 lines
370 B
C++
#ifndef MYSINGLETON_H_
|
|
#define MYSINGLETON_H_
|
|
|
|
template<class T>
|
|
class MySingleton {
|
|
public:
|
|
static T* instance() {
|
|
static T _instance;
|
|
return &_instance;
|
|
}
|
|
;
|
|
protected:
|
|
MySingleton() {
|
|
}
|
|
;
|
|
virtual ~MySingleton() {
|
|
}
|
|
;
|
|
MySingleton(const MySingleton &);
|
|
MySingleton& operator=(const MySingleton &);
|
|
};
|
|
|
|
#endif
|