[sigc] Re: binding by value, slot taking reference was Re: [gtkmm] binding arguments to slots



Am 2003.11.18 00:45 schrieb(en) gtkmm mailing list account:
Bonsoir,
Thank you for your help.
Le Lundi 17 Novembre 2003 19:41, Martin Schulze a écrit :
> Am 2003.11.17 15:23 schrieb(en) gtkmm mailing list account:
> > It look like there is a stringent limitation on the number of
> > arguents
> >
> > :-(
>
> The limitation will be lifted in libsigc++-2.0.

Cool !
<snip>
>
> > Is there a way to expand it (recompiling libsigc++1.2 ) ?
>
> Yes. You have to edit sigc++/macros/bind.h.m4. The last "paragraph"
> of the file is of interest. Add ADAPTOR_BIND_DATA(ARGS(C,3)), etc.;
> maybe also some ADAPTOR_BIND_SLOT(...) commands are needed.

Thank you, I'll try, but I think I will wait for libsigc++-2.0.

There is still something I don't understand with slot and bind :

I would like to make a slot for a function taking arguments by
reference:
program :
"
using namespace std;
using namespace SigC;

void foo1(int& i){++i;}

int main(int argc, char** argv){
int i=1;
Slot0<void>slot1=bind(slot(foo1),i);
 return 0;
}

Try to specify the argument type as template parameter, i.e.:

  Slot0<void> slot1 = bind<int&>(slot(foo1), i);

I'm not sure if it works, though - let us know!

BTW in libsigc++-2.0 you will be able to write:

  sigc::slot<void> slot1 = sigc::bind(foo1, sigc::ref(i));

instead.

Regards,

  Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]