|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-14 09:24:51
From: "Steven Ketcham" <sketcham_at_[hidden]>
> MSVC 6.0
>
> typedef boost::function0<void> CallBackFunctionEmpty;
> CallBackFunctionEmpty f = boost::bind(&MyClass::SomeFunction,
> classInstance);
>
> The destructor of MyClass is called multiple times.
> Is this correct?
You are storing a copy of classInstance in the function object returned by
boost::bind. If you want to store a pointer or reference, use
boost::bind(&MyClass::SomeFunction, &classInstance);
or
boost::bind(&MyClass::SomeFunction, boost::ref(classInstance));
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk