gcc: specialization only in the correct namespace, thx to Sam Miller
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@608 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
60ef3a12e2
commit
2dd3452a84
2 changed files with 29 additions and 16 deletions
|
@ -855,19 +855,25 @@ namespace Loki
|
|||
static T& Instance();
|
||||
};
|
||||
|
||||
/// \def LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER)
|
||||
/// Convenience macro for the definition of the static Instance member function
|
||||
/// Put this macro called with a SingletonHolder typedef into your cpp file.
|
||||
|
||||
#define LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER) \
|
||||
template<> \
|
||||
SHOLDER::ObjectType& ::Loki::Singleton<SHOLDER::ObjectType>::Instance() \
|
||||
{ \
|
||||
return SHOLDER::Instance(); \
|
||||
}
|
||||
|
||||
} // namespace Loki
|
||||
|
||||
|
||||
/// \def LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER)
|
||||
/// Convenience macro for the definition of the static Instance member function
|
||||
/// Put this macro called with a SingletonHolder typedef into your cpp file.
|
||||
|
||||
#define LOKI_SINGLETON_INSTANCE_DEFINITION(SHOLDER) \
|
||||
namespace Loki \
|
||||
{ \
|
||||
template<> \
|
||||
SHOLDER::ObjectType& Singleton<SHOLDER::ObjectType>::Instance() \
|
||||
{ \
|
||||
return SHOLDER::Instance(); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Change log:
|
||||
// May 21, 2001: Correct the volatile qualifier - credit due to Darin Adler
|
||||
|
@ -883,6 +889,9 @@ namespace Loki
|
|||
#endif // SINGLETON_INC_
|
||||
|
||||
// $Log$
|
||||
// Revision 1.29 2006/03/15 08:47:18 syntheticpp
|
||||
// gcc: specialization only in the correct namespace, thx to Sam Miller
|
||||
//
|
||||
// Revision 1.28 2006/03/03 11:58:24 syntheticpp
|
||||
// also compile with gcc
|
||||
//
|
||||
|
|
|
@ -21,13 +21,17 @@ typedef Loki::SingletonHolder<Foo> FooSingleton;
|
|||
|
||||
LOKI_SINGLETON_INSTANCE_DEFINITION(FooSingleton)
|
||||
/*
|
||||
// code generated by the macro:
|
||||
Foo& Loki::Singleton<Foo>::Instance()
|
||||
{
|
||||
return FooSingleton::Instance();
|
||||
};
|
||||
namespace Loki
|
||||
{
|
||||
template<>
|
||||
FooSingleton::ObjectType& Singleton<FooSingleton::ObjectType>::Instance()
|
||||
{
|
||||
return FooSingleton::Instance();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
template<>
|
||||
Foo& Singleton<Foo>::Instance()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue