diff --git a/include/loki/Singleton.h b/include/loki/Singleton.h index 1402cee..5d874bd 100644 --- a/include/loki/Singleton.h +++ b/include/loki/Singleton.h @@ -52,7 +52,7 @@ namespace Loki static bool Compare(const LifetimeTracker* lhs, const LifetimeTracker* rhs) { - return lhs->longevity_ < rhs->longevity_; + return lhs->longevity_ > rhs->longevity_; } private: @@ -71,6 +71,7 @@ namespace Loki template struct Deleter { + typedef void (*Type)(T*); static void Delete(T* pObj) { delete pObj; } }; @@ -105,7 +106,7 @@ namespace Loki template void SetLongevity(T* pDynObject, unsigned int longevity, - Destroyer d = Private::Deleter::Delete) + Destroyer d) { using namespace Private; @@ -137,6 +138,13 @@ namespace Loki std::atexit(Private::AtExitFn); } + template + void SetLongevity(T* pDynObject, unsigned int longevity, + typename Private::Deleter::Type d = Private::Deleter::Delete) + { + SetLongevity::Type>(pDynObject, longevity, d); + } + //////////////////////////////////////////////////////////////////////////////// // class template CreateUsingNew // Implementation of the CreationPolicy used by SingletonHolder