From 941cb9f4124c9ccfd5c845bc94639fa46df12c3d Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 1 Apr 2008 17:45:04 +0000 Subject: merge release@83343 skinning-1-merge@83714 -> release QAR-424 --- indra/llcommon/llmemory.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/llcommon/llmemory.h') diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index b0a47b6820..cc57e658fb 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -419,6 +419,31 @@ protected: // Foo* instance = FooSingleton::getInstance(); // // As currently written, it is not thread-safe. +#if LL_WINDOWS && _MSC_VER < 1400 // this is Visual C++ 2003 or earlier +// workaround for VC7 compiler bug +// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx +// our version doesn't introduce a nested struct so that you can still declare LLSingleton +// a friend and hide your constructor + +template +class LLSingleton +{ +public: + static T* getInstance() + { + LLSingleton singleton; + return singleton.get(); + } +private: + T* get() + { + static T instance; + return &instance; + } + +}; +#else + template class LLSingleton { @@ -430,6 +455,8 @@ public: } }; +#endif + //---------------------------------------------------------------------------- // Return the resident set size of the current process, in bytes. -- cgit v1.2.3