[signals] References rather than copies of functors in slots

It appears that when a slot is attached to a signal it is copied in. However, if the slot contains a functor, and I want to modify the contents of the functor object, then those changes are not made in the slot since it is a copy of the original object. This is probably a really simple question, but how do tell a signal to hold references/pointers to slot objects rather than copies? Is there a trick with boost::shared_ptr or something? Thanks for any tips. James

AMDG James C.Sutherland wrote:
It appears that when a slot is attached to a signal it is copied in. However, if the slot contains a functor, and I want to modify the contents of the functor object, then those changes are not made in the slot since it is a copy of the original object.
This is probably a really simple question, but how do tell a signal to hold references/pointers to slot objects rather than copies? Is there a trick with boost::shared_ptr or something?
Using boost::ref should work. In Christ, Steven Watanabe
participants (2)
-
James C. Sutherland
-
Steven Watanabe