Correction for the code: need to force static var instantiation and
properly call Ref(). Not sure if init in constructor can be optimized
out by sufficiently daring compiler?
template <class T, class F = NewObject<T>, int instance=0>
class Singleton
{
public:
Singleton(F objectFactory = F())
: m_objectFactory(objectFactory)
{ init; }
...
private:
static const T* init;
};
template<class T, class F, int instance>
const T* Singleton<T, F, instance>::init = Singleton<T, F, instance>
().Ref();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---