Re: [sigc] How to use sigc::bind<>
- From: Martin Schulze <martin-ml hippogriff de>
- To: Jeff Franks <jcf tpg com au>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] How to use sigc::bind<>
- Date: Sun, 9 Nov 2003 10:38:21 +0100
Am 2003.11.09 08:32 schrieb(en) Jeff Franks:
Hi,
Can you explain how sigc::bind<#> works. I know that the # in the
angled brackets indicates the position of the bound argument. I've
looked at the examples in the tests directory but I'm still confused.
I will commit some doxygened documentation to cvs later today.
Maybe the following examples are more instructive:
sigc::signal<void> some_signal;
void foo(int);
some_signal.connect(sigc::bind<0>(&foo,10));
// binds to the last (only) argument of foo
some_signal.connect(sigc::bind<0>(sigc::ptr_fun(&foo),10))
// same as above. Of course, sigc::mem_fun() can also be used.
void bar(int,int);
some_signal.connect(sigc::bind<0>(&bar,10,20));
// binds two arguments at a time
sigc::signal<void,int> other_signal;
other_signal.connect(sigc::bind<0>(&bar,20));
// binds to the last (second) argument of bar
other_signal.connect(sigc::bind<1>(&bar,10));
// binds to the first argument of bar
Regards,
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]