
On Wed, 5 Jan 2005 19:02:44 -0000, Dave Handley wrote
Is there any other functionality that should be added? Specifically, is it sufficient to enforce that singletons are created in a specific order before main and destroyed in the reverse order after main (using dependency instances), or should I provide some way to support alternate lifetimes (ex: create on first reference to instance)?
Ordering of Singletons is, in my opinion, one of the most important issues with Singletons. It is almost certainly insufficient in most applications to create in a specific order, and delete in reverse order.
Yep -- I've spent way to much time fighting the 'crash on exit' problems associated with unordered singleton destruction at program shutdown (not my code, of course :-)
Is there any interest in adding this library to Boost?
I would love to see a robust implementation of a Singleton in Boost.
Yep, we should have one. However, I agree, something more along the lines of the Loki singleton would be better than the proposal from 'Mr. Chaos'....
Whenever I start a software project, almost without exception I tend to add both Boost and Loki to the project - it would be great if I could add only Boost. I have to say however, that a more general library which implemented a variety of design patterns (like Loki) would be even better. For example:
1) Singleton 2) Visitor - like Loki implementing both a conventional cyclic visitor, and an acyclic visitor. 3) Composite 4) Abstract Factory 5) etc. etc.
Agree, agree,.... Jeff