summaryrefslogtreecommitdiffstats
path: root/src/include/util/singleton.H
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/util/singleton.H')
-rw-r--r--src/include/util/singleton.H18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/util/singleton.H b/src/include/util/singleton.H
new file mode 100644
index 000000000..f448303df
--- /dev/null
+++ b/src/include/util/singleton.H
@@ -0,0 +1,18 @@
+#ifndef __UTIL_SINGLETON_H
+#define __UTIL_SINGLETON_H
+
+template <typename _T>
+class Singleton : private _T
+{
+ public:
+ static _T& instance()
+ {
+ static Singleton<_T> instance;
+ return instance;
+ };
+
+ private:
+ Singleton() : _T() {};
+};
+
+#endif
OpenPOWER on IntegriCloud