
16 Jan
2009
16 Jan
'09
5:58 p.m.
AMDG Alexander wrote:
The current version of Boost candidate Signelton as well as other implementation is CRTP base. However, one may want to use it as local class
my_class& get_something(std::string const& param) { struct local : singleton<local> { ... }; return local::instance->some_method(param); }
The problem is not CRTP, per se, but templates. It is not legal to pass a local class as a template parameter. I don't see how you can implement a singleton generically without using templates. Sorry, but I think the only solution is to move the local class to namespace scope. In Christ, Steven Watanabe