summaryrefslogtreecommitdiff
path: root/dxr3singleton.h
diff options
context:
space:
mode:
Diffstat (limited to 'dxr3singleton.h')
-rw-r--r--dxr3singleton.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/dxr3singleton.h b/dxr3singleton.h
index b289328..ebfbe42 100644
--- a/dxr3singleton.h
+++ b/dxr3singleton.h
@@ -28,27 +28,25 @@
Is a nice solution to use only
one instance of a class.
*/
-template<typename T>
-class Singleton
-{
+template <class T>
+class Singleton {
+public:
+ virtual ~Singleton() {}
+ static T& Instance();
+
protected:
Singleton() {}
- virtual ~Singleton() {}
-public:
- static T& Instance()
- {
- static T m_Instance;
- return m_Instance;
- }
-
- static T* InstanceP()
- {
- static T* m_InstanceP = new T;
- return m_InstanceP;
- }
+private:
+ Singleton(const Singleton&);
};
+template <class T>
+T& Singleton<T>::Instance() {
+ static T instance;
+ return instance;
+}
+
#endif /*_DXR3_SINGLETON_H_*/
// Local variables: