Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-07-27 17:32:34


Fernando Cacciola wrote:

>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).
>>
>>[...]
>>
>>
>
>Use Boost.Optional:
>
>http://www.boost.org/libs/optional/doc/optional.html
>
>
I don't see how this helps... optional does not appear to allow member
functions to be called when the object does not exist. Instead, it
simply asserts that the object does exist before the -> operator
returns. For my hypothetical zombie_ptr, I want to make usage when the
instance does not exist a no-op, not an error.

-Jason


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk