
On Mon, Jan 25, 2010 at 09:25:51PM +0300, Andrew Chinkoff wrote:
Singleton.hpp have just corrected.
There have been many suggestions in the past of singleton implementations to this list, all flawed in subtle and not so subtle ways. I strongly recommend finding those and the feedback on them and understand them. Your code suffers from among other things. * You do not follow the boost naming_convention. * You use reserved identifiers in several places - __SINGLETON_HPP__, - ___DOOMED_SINGLETON_MUST_NOT_BE_ARRAY___). * Your SINGLETON_IS_MY_FRIEND macro lacks the BOOST_ prefix and could likely be worded better. * Your implementation is rigid and does not have any policies to * indicate whether thread-safety is required, etc. * I'm sure that your CTAssert concept can be replaced by the proper existing Boost implementation of such a compile-time assertion. * Your implementation is limited to types with nullary constructors. Again, I recommend researching why the previous ambitious attempts have not been universally accepted. -- Lars Viklund | zao@acc.umu.se | 070-310 47 07