RE: [sigc] How to use sigc::bind<>
- From: Murray Cumming Comneon com
- To: jcf tpg com au, martin-ml hippogriff de
- Cc: libsigc-list gnome org
- Subject: RE: [sigc] How to use sigc::bind<>
- Date: Sun, 9 Nov 2003 11:50:16 +0100
> [mailto:libsigc-list-admin gnome org] On Behalf Of Jeff Franks
> Martin Schulze wrote:
>
> > 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
> >
> This is where I had confusion, bind<0> binds to the last
> argument, not
> the first, as zero might imply. I find the explanation bind<0> (zero)
> binds to the last (second) argument of bar confusing. Compared with
> bind<1> (first) binds to the first argument of bar, which sounds
> logical. Initially I thought that the # in bind<#> meant that
> you could
> specify which argument position in the bound function the
> bound argument
> would be passed to, such as zero for the first, 1 for the
> second, 2 for
> the third, etc, like a zero-based index. That would leave bind<#> to
> create a slot functor with one less argument, based on the remaining
> arguments, as is required.
>
> I'm sure this will confuse many programmers.
It confuses me.
Murray Cumming
www.murrayc.com
murrayc usa net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]