Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-03-29 10:44:57


Rob Stewart wrote:

>IOW, if basic_singleton requires that the Creator template
>argument derive from creator_base, and creator_base uses a
>noninstantiable technique, then the client cannot create a
>Creator instance, so the only way to create an instance of type T
>is if T permits it.
>
>
Exactly.

>Provided that using basic_singleton<T> places no contrary burdens
>on T such that basic_singleton<T> controls (a) common, Singleton
>instance(s), yet other T's can be instantiated directly, it
>sounds good. Unfortunately, the functionality you described was
>provided by singleton_base suggests that this isn't the case.
>
>Am I missing something still?
>
The functionality is provided in terms of a member class, called
pointer. If T derives from singleton < T >, client code can use
T::pointer instances to get at the singleton instance. If T does not
derive from singleton < T >, client code must use singleton < T
>::pointer instances to refer to the singleton instance.

-Jason


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