Boost logo

Boost :

From: graham.shanks_at_[hidden]
Date: 2002-10-14 19:09:34

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.

>I didn't run this through a compiler so please forgive me if I made a typo or
>other mistake. ;)

Freely forgiven, especially since it seems to me that a wrapper of this sort
would offer a more natural syntax than my suggested

  sig.connect(boost::bind(&EventCounter::operator(), &eventCounter));

I'm going to have a think about this - I'm sure that you have something.

Graham Shanks

Boost list run by bdawes at, gregod at, cpdaniel at, john at