Boost logo

Boost Users :

Subject: Re: [Boost-users] [pool] Singleton implementation
From: Eric J. Holtman (eric_at_[hidden])
Date: 2009-10-20 09:52:45


Robert Ramey wrote:
>
>> Basically, you need to ensure the templates (which contain static
>> data) get instantiated only once.
>>
>
> how do you do this?
>
>

This is not a Loki mailing list, so I don't want to chew up
tons of bandwidth, but you can look at SingletonDLL
under their distribution for hints.

I've found that there's still some wonky-ness with
Microsoft's compiler, and so I pretty much gave up
on trying to globally fix the issues, and ending up
having actual concrete classes for my factories,
which inside their .cpp implemetation files used
the templated Singletons in an anonymous namespace.

That way, the templates only ever appear in implemetation
files, but not in headers, so I only get one copy.

Maybe someday I'll go back and re-visit the issue,
but the last time I looked into it, I was more interested
in "a solution for Eric's programs" than the "100% correct
solution for everyone's programs".


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net