aboutsummaryrefslogtreecommitdiff
path: root/common/singleton.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/singleton.h')
-rw-r--r--common/singleton.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/singleton.h b/common/singleton.h
index 6c36d7a37d..9bcd590183 100644
--- a/common/singleton.h
+++ b/common/singleton.h
@@ -88,7 +88,14 @@ protected:
static T *_singleton;
};
-template<class T> T *Singleton<T>::_singleton = 0;
+/**
+ * Note that you need to use this macro from the Common namespace.
+ *
+ * This is because C++ requires initial explicit specialization
+ * to be placed in the same namespace as the template.
+ */
+#define DECLARE_SINGLETON(T) \
+ template<> T *Singleton<T>::_singleton = 0
} // End of namespace Common