Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-09 06:56:04


From: "David B. Held" <dheld_at_[hidden]>
> "Paul Mensonides" <pmenso57_at_[hidden]> wrote in message
> news:002a01c2270d$cd16d940$7772e50c_at_c161550a...
> > One concern however.... should the closure facility disallow normal
> copying if
> > it is working in concert with a shared_ptr?

You need to return the closure by value, so it has to be copyable.

> I have no idea! I barely grok the implementation. One thing that worries
> me
> is that you leak the pointer to create the closure. What would be nice is
> if
> the closure itself contained a shared_ptr! Otherwise, the shared_ptr
might
> self-delete, and someone might try to call the closure.

This depends on whether you need a closure library or just an operator->*.
You aren't allowed to do anything with the result of ->*; the only thing you
are allowed to do is to immediately apply operator() to it. There is no need
to worry about lifetime issues.


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