|
Boost : |
From: Thomas Matelich (toms-mailing-lists_at_[hidden])
Date: 2001-11-15 18:14:16
Peter Dimov wrote:
> > In
> > that respect, this code clearly communicates that "A isa singleton":
> >
> > class A : public singleton<A> {
> > /* ... */
> > };
>
> Is this a library interface? If it is, why do you need the class name at
> all? You know that there is a single instance of A.
>
> Instead of
>
> class A: public /* public? */ singleton<A>
> {
> void f();
> };
>
> A::instance().f();
>
> why not simply
>
> namespace A
> {
> void f();
> }
>
> f();
Funny you should mention this. We (my coworkers and I) have been pretty bad about
using too many singletons, and I recently rewrote one of them like that. I just might
be hooked. I'm getting really tired of A::Instance() especially since A is usually
something like ProcedureManager.
-- Thomas O Matelich Senior Software Designer Zetec, Inc. matelich_at_[hidden] tmatelich_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk