Boost logo

Boost Users :

Subject: Re: [Boost-users] Best practice for singletons?
From: Chris Cleeland (chris.cleeland_at_[hidden])
Date: 2012-04-11 11:50:36


2012/4/11 Klaim - Joël Lamotte <mjklaim_at_[hidden]>

> Hi,
>
> The singletons in boost are supposed to be only used by boost libraries. I
> dont know if it's your case but if it's not, you shouldn't try to use it.
>

There are a couple that are exposed in public interfaces. Specifically, I
refer to the singleton in serialization as well as the singleton in exposed
in pool. I understand that those in "detail" are hidden, but that would
not prevent me from duplicating them in my own code if one particular
implementation is considered a best-practice.

> Someone proposed an alternative that might be more interesting, if it fits
> your need: http://comments.gmane.org/gmane.comp.lib.boost.devel/222463
>
>
Thanks for that reference! Singularity addresses one big issue I typically
contend with regarding singletons--lifecycle--but the other cited issues
(scope and initialization) are generally not issues for me. The notion of
"singularity" being an orthogonal attribute to so many others.

-- 
Chris Cleeland


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