
Thank you very much Steven, boost::ref worked fine. Just for my education, what is the rationale behind making a copy of the signaled object ? It seems odd to me since the object interested in receiving the event ends up not receiving it (unless we use boost::ref). I am obviously missing something conceptually here. If you or anyone could explain it to me I'd really appreciate. Thanks again. Mau. 2010/8/19 Steven Watanabe <watanabesj@gmail.com>:
AMDG
Mauricio Gomes wrote:
I am running the program below (Vista with boost 1.43, mingw/gcc 4.5.1).
I would expect slot.x to be 5 but it is zero.
Why boost::signal creates another instance of the slot object ? What am I missing here ?
boost::signal stores a copy of the function object. If you don't want to make a copy use boost::ref.
sig.connect(boost::ref(f));
If you do this, you need to be careful that the function object doesn't go out of scope too soon.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Mau