Any use of a Singleton<> template
I currently working on a Singleton<> template, which currently has these features. 1) Supports the same interface/concepts as auto_ptr<> 2) One Line option to create a working singleton 3) Possible to use different Singletons of same type using names (simultaneously) 4) Possible to store different Singleton Objects under the same name (not simultaneously) 5) Possible to Release By Reference (Optional, Not Default) 6) Automatic Cleanup at program termination (Optional, Default) It can be used in the following manner: class SingletonObject { void someFunction(); ... }; Singleton<SingletonObject> singleton; singleton->someFunction(); Is there any interrest in such a class? Peter Sixhøj
Can you compare/contrast your library to SingletonHolder<> in the Loki
library as described by Andrei Alexandrescue in "Modern C++ Design?"
I would guess that Andrei's singleton is probably the most familiar to
people on this list and I suspect that if he survives the slings and arrows
of submitting his smart pointer he will offer this as well.
On 2/8/02 6:51 AM, "sixfurdk"
I currently working on a Singleton<> template, which currently has these features.
1) Supports the same interface/concepts as auto_ptr<> 2) One Line option to create a working singleton 3) Possible to use different Singletons of same type using names (simultaneously) 4) Possible to store different Singleton Objects under the same name (not simultaneously) 5) Possible to Release By Reference (Optional, Not Default) 6) Automatic Cleanup at program termination (Optional, Default)
It can be used in the following manner:
class SingletonObject { void someFunction(); ... }; Singleton<SingletonObject> singleton;
singleton->someFunction();
Is there any interrest in such a class?
Peter Sixhøj
-- Jon Kalb Kalb@LibertySoft.com
--- In Boost-Users@y..., Jon Kalb
Can you compare/contrast your library to SingletonHolder<> in the Loki library as described by Andrei Alexandrescue in "Modern C++ Design?"
I've briefly compared the Loki SingletonHolder<> with Singleton<>, and have a few conclusions.
From the suggested feature list, these are not supported by Loki (by quick examination):
1) Supports the same interface/concepts as auto_ptr<>
3) Possible to use different Singletons of same type using names
(simultaneously)
5) Possible to Release By Reference (Optional, Not Default)
1) is useful for defining LinkPolicies. Consider the following:
template
I would guess that Andrei's singleton is probably the most familiar to people on this list and I suspect that if he survives the slings and arrows of submitting his smart pointer he will offer this as well.
Not, to mention that the SingletonHolder<> is older and has been tested by many people... I'll work with the SingletonHolder to gain more experience with it. Peter Sixhøj
participants (2)
-
Jon Kalb
-
sixfurdk