N
Nick Keighley
Hi,
I found this in code I was maintaining
template <class SingletonClass>
SingletonClass* Singleton<SingletonClass>::instance ()
{
static SingletonClass _instance;
return &_instance;
}
there are indications that the constructor is getting called more than
once
in some circumstances (tracing in one of the instantiations of the
template).
Are there potential problems with the use of static data?
I found this in code I was maintaining
template <class SingletonClass>
SingletonClass* Singleton<SingletonClass>::instance ()
{
static SingletonClass _instance;
return &_instance;
}
there are indications that the constructor is getting called more than
once
in some circumstances (tracing in one of the instantiations of the
template).
Are there potential problems with the use of static data?