|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2008-02-04 03:01:17
Hello John, thanks for your review
John Torjo ha escrito:
> > * What is your evaluation of the implementation?
> >
> I like it. Did not go into too much detail, but from what I've looked
> at, it's ok.
>
> One thing I don't like is the initialization of boost::flyweight:
> http://svn.boost.org/svn/boost/sandbox/flyweight/libs/flyweight/doc/tutorial/technical.html
> I think there could be a simpler way to do this:
> http://www.entropygames.net/globals.htm
Well, static_holder (which is conceptually very similar to a singleton) does in fact
relies on Meyers' idiom, all the complications described at the referred section stems from
the fact that initialization is forced to happen in pre-main() time to avoid multi-threaded
clashes (which are deemed more unlikely before than after main() starts). Note that
the singletons described at your article can pose problems if first accessed
simultaneously from two different threads --this is what I tried to avoid in my lib.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk