Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-03-05 06:35:27

Martin wrote:

>Thanks, it compiles now and works but I do get several warnings (also with the
>test programs), see below.
>Just a question. Is it possible to have the singleton automaticly created at
>program start?
>(A global variable isn't an option since that is what I'm trying to avoid in
>the first place)
Keep at least one global or static pointer to the singleton. The global
pointer is different in concept than a real global instance, as it is
being used to control the moment of creation, rather than to provide a
global point of access. You can hide the global pointer in an unnamed
namepace in some obscure source file if you want to make it really clear
that it isn't the access mechanism.

>Here are the warnings (they are repeated several times)
>boost\singleton\leaky_lifetime.hpp(207) : warning
>C4512: 'boost::singleton::leaky_lifetime_ex<CreationPolicy,Creator,Lock>::lifet
>ime<Type>::auto_set<T>' : assignment operator could not be generated
>boost\singleton\creators.hpp(174) : warning
>C4511: 'boost::singleton::create_using_new_ex<NoThrow>::creator<Type>::creatabl
>e<Base>' : copy constructor could not be generated
Disabling of the singleton's default copy constructor was intentional,
you can ignore or disable this warning.

>boost\singleton\creators.hpp(181) : warning C4127: conditional expression is
>boost\singleton\leaky_lifetime.hpp(77) : warning C4127: conditional expression
>is constant
The conditional expression is a template argument (whether or not to use
nothrow new), and ideally the condition itself should be optimized away
by the compiler because it is constant. Perhaps I need to add some
#pragma warning disablers for when the code is compiled with visual
studio. The warnings you are getting should be harmless.


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