Boost Users :
Subject: Re: [Boost-users] "weak" binding to member?
From: Igor R (boost.lists_at_[hidden])
Date: 2011-09-12 13:41:38
> I don't know what you mean by that.
I mean that you can pass a weak_ptr along with the binder:
void setYourFunctor(const function<void(void)> &func, const
// store "func" and "track"
func_ = func;
track_ = track;
// Now in the place where "func_" should be called:
shared_ptr<void> p = track_.lock();
// Now use it this way:
shared_ptr<YourClass> ptr = ...;
setYourFunctor(bind(&YourClass::doSomething, ptr.get()), ptr);
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net