|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-07-27 10:33:50
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk