Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-06-25 00:43:06


"David Abrahams" <dave_at_[hidden]> wrote in message
news:871wg12mia.fsf_at_grogan.peloton...
>> #define BOOST_TEST_SINGLETON_INST( inst ) \
>> namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst,
>> _t)::instance(); }
>>
>> Here inst ## _t is type of singleton and inst is a reference to the
>> instance
>
> If your question is whether you are allowed to use references inside
> unnamed namespaces, the answer is yes.
>
> I note that you are still using dynamic initialization above. Using
> brace-initialization is important to avoid order-of-initialization
> problems.

I will look into your solution. In my projects it's not usually the problem.
If I need to refer to one singleton from different singleton constructor I
always use type::instance().

Gennadiy


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