aboutsummaryrefslogtreecommitdiff
path: root/src/mnemonics/singleton.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mnemonics/singleton.h')
-rw-r--r--src/mnemonics/singleton.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mnemonics/singleton.h b/src/mnemonics/singleton.h
new file mode 100644
index 000000000..0cefba923
--- /dev/null
+++ b/src/mnemonics/singleton.h
@@ -0,0 +1,16 @@
+namespace Language
+{
+ template <class T>
+ class Singleton
+ {
+ Singleton() {}
+ Singleton(Singleton &s) {}
+ Singleton& operator=(const Singleton&) {}
+ public:
+ static T* instance()
+ {
+ static T* obj = new T;
+ return obj;
+ }
+ };
+}