Boost logo

Boost :

From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2002-10-14 21:50:27


On Tue, 15 Oct 2002 graham.shanks_at_[hidden] wrote:
> Dirk Gerrits wrote:
> >I'd use this:
> >
> >sig.connect( boost::ref(eventCounter) );
> >
> >That way, a reference to your original object should get connected instead
> >of a copy, so the output of your test program should be 1.
>
> Unfortunately boost::ref returns a boost::reference_wrapper<T>, whose
> operator() returns a T*, which doesn't match the requirements of a slot.

boost::reference_wrapper<T> is a special case for Boost.Signals (just as
it is for Bind, Lambda, and Function) that asks those libraries to use a
reference to an existing object instead of making a copy.

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk