Boost logo

Boost :

From: Branko Èibej (branko.cibej_at_[hidden])
Date: 2000-05-30 11:10:58


I've a few questions/comments:

First, I'm not convinced that it's a good idea to be able to instantiate
a class both as a singleton and an "ordinary" object. If interface
compatifility is what you're after, there are other (better) ways to
do that.

Petr Kocmid wrote:
> - idea to have a singleton object of any arbitrary type which will come
> on my mind later, declared by simple template expansion on that type
> and intermix singleton functionality with class hiearchy architecture.

If I understand your source correctly, you can't define a hierarchy of
singletons, something like this:

class A { virutal void foo() {/*...*/} };
class B : public A { virtual void foo {/*...*/ };

// We want to create singleton B ...
singleton_ptr<B>();

// ... and access it as an A
singleton_ptr<A>.foo();

This will always call A::foo. It'd be nice to have a way to "register"
a derived class singleton and use the base class interface to access it.

[snip]
> With g++, you MUST control factory instantiation by obscure
> -frepo or manage instantiation manually with -fno-implicit-templates.

What system are you using g++ on, and which version? As far as I know,
recent versions shouldn't have that problem.

    Brane

-- 
Branko Èibej                 <branko.cibej_at_[hidden]>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49     fax: (+386 1) 586 52 70

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk