
27 Jul
2005
27 Jul
'05
3:33 p.m.
Jason Hise wrote:
I am trying to come up with a mechanism which allows member functions of the singleton to be called if the instance exists, and which do nothing if the instance does not exist (no creation is attempted, the operation is simply skipped). My current idea is a member function of the singleton pointer named zombie_call, which would be used something like:
ptr.zombie_call ( &MySingletonType::SomeFunc, param1, param2, ... );
The only problem I have is what to do if the instance does not exist and the member function has a return value.
Use Boost.Optional: http://www.boost.org/libs/optional/doc/optional.html HTH Fernando Cacciola SciSoft