From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2008-01-23 06:52:06
Kowalke Oliver (QD IT PA AS) wrote:
> Hi Tobias,
> how does Boost.Utility/Singleton solve the problem if the singleton calss itself needs arguments in its ctor (for instance if I want to use the RAII pattern)?
Not at all, you have to solve it yourself.
So reading from you post you have a class you can't (or don't want to)
change, that needs arguments in the ctor. You can make a Singleton from
that class using multiple inheritance.
class a_singleton : public boost::singleton< a_singleton >,
a_singleton(boost::restricted) : my_class( /* args go here */ )
Parameterizing the static 'instance' method of a classic Singleton take
is a bad idea IMO, because it causes redundancy all over the place.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk