Boost logo

Boost Users :

Subject: Re: [Boost-users] [signals] References rather than copies of functors in slots
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-14 13:26:51


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


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