
14 Feb
2005
14 Feb
'05
2 p.m.
Sérgio Vale e Pace wrote:
On Sun, 13 Feb 2005 19:20:07 -0500, Jason Hise <chaos@ezequal.com> wrote:
I recently discovered that my singleton could potentially be used in a way other than as a base class. For example, to create and use a singleton instance of a class which could have other ordinary instances as well, one could just do:
class Example { public: void foo ( ) { } };
// elsewhere...
singleton < Example >::pointer ptr; ptr->foo ( );
I believe (as in "I didn´t tested it" :) that using it in this way would allow multiple instances of Example? For example?
singleton<Example>::pointer ptr; Example other;
This is not a problem. The designer of Example does permit such use: Example a; Example b;