It happens that I need the infamous singleton picture. Even better, it happens that I need the infamous C ++ templates in combination with this template. So what bothers me is:
template <class T> class PDatabaseTable { ... static PDatabaseTable <T> & instance() { static PDatabaseTable <T> singleton; return singleton; } ... };
This is a typical singleton implementation that should be created upon first use. Now we have a static singleton variable. Since the instance () function can be called from several different modules, the question arises: will there be only one instance of the object for any given type T , or will each module create its own singleton?
Septagram
source share