summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-05-17 16:00:28 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-05-17 16:00:28 +0200
commitf9b68bafd90941d9faf53e5e2771361e3ab4336a (patch)
treeadb88053a6e68003ff57dd2dfc8dc6d07b728aa5 /include
parent73ad6a97531b6bc1d311eceb6ba2770fdf407b81 (diff)
downloadastra-f9b68bafd90941d9faf53e5e2771361e3ab4336a.tar.gz
astra-f9b68bafd90941d9faf53e5e2771361e3ab4336a.tar.bz2
astra-f9b68bafd90941d9faf53e5e2771361e3ab4336a.tar.xz
astra-f9b68bafd90941d9faf53e5e2771361e3ab4336a.zip
Add sanity check
Diffstat (limited to 'include')
-rw-r--r--include/astra/Singleton.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/astra/Singleton.h b/include/astra/Singleton.h
index 1ef4bba..784c521 100644
--- a/include/astra/Singleton.h
+++ b/include/astra/Singleton.h
@@ -86,14 +86,14 @@ class Singleton {
// libastra. This situation would cause issues when .mex files are unloaded.
#define DEFINE_SINGLETON(T) \
-template<> void Singleton<T >::construct() { m_singleton = new T(); } \
+template<> void Singleton<T >::construct() { assert(!m_singleton); m_singleton = new T(); } \
template<> T* Singleton<T >::m_singleton = 0
// This is a hack to support statements like
// DEFINE_SINGLETON2(CTemplatedClass<C1, C2>);
#define DEFINE_SINGLETON2(A,B) \
-template<> void Singleton<A,B >::construct() { m_singleton = new A,B(); } \
+template<> void Singleton<A,B >::construct() { assert(!m_singleton); m_singleton = new A,B(); } \
template<> A,B* Singleton<A,B >::m_singleton = 0
} // end namespace