Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-06-07 08:56:04


AMDG

Richard Dingwall wrote:
> person subject;
> mock_handler handler(subject);
>
> subject.updated.connect(handler);
>
>
> Unfortunately, when this code runs, it produces the following output:
>
> <snip>
>
> I'm not sure what's going on here, or why mock_handler's destructor is
> being called 4 extra times.
>
> Can anyone shed some light as to why this might be happening?
>

The handler is being copied. To prevent this try using boost::ref

subject.updated.connect(boost::ref(handler));

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