Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-01-18 14:58:42

Tobias Schwinger:

> Peter Dimov wrote:
>> What is the reason to prefer the current instance/lease formulation
>> instead
>> of
>> typedef ... instance_type;
>> instance_type instance(); // automatically serves as a lease
>> ?
> As we can't expose the instance when automatic locking is done, it is
> supposed to provide a means to not have to access the instance directly.

I'm not sure what this reformulation cannot do that the original can. An
ordinary singleton can define instance_type as T*. A synchronized singleton
can define instance_type as the moral equivalent of shared_ptr<T> (with a
hidden unlocking deleter). What am I missing?

Boost list run by bdawes at, gregod at, cpdaniel at, john at