Re: [sigc] bind arguments within mem_fun()
- From: Andreas Matthias <andreas matthias tuwien ac at>
- To: Martin Schulze <martin-ml hippogriff de>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] bind arguments within mem_fun()
- Date: Thu, 02 Sep 2004 10:39:44 +0200
Martin Schulze wrote:
> Am 01.09.2004 15:50:51 schrieb(en) Andreas Matthias:
>> Is it possible to bind an argument to a function that is referenced
>> by mem_fun()?
>
> Yes - you can use sigc::bind() (see below).
Oh, I see. I am ashamed. It is mentioned in the docs but I haven't
seen it.
>> sigc::mem_fun(*this,
>> boost::bind(&A::foo, boost::ref(*this), 99))();
>
> The line above doesn't make sense: the call to sigc::mem_fun() is
> superfluous.
> What you want is:
>
> sigc::bind(sigc::mem_fun(&A::foo, *this), 99)();
Yes, that's what I want. :-)
BTW, you have mixed the arguments of mem_fun().
> sigc::bind(&A::foo, sigc::ref(*this), 99)();
This one doesn't work.
> Note that mixing boost::bind() (and similar stuff) with the sigc API is
> possible but not recommended because auto-disconnection from signals
> that you connect to the resulting functors won't work.
I see.
Thanks for your help.
Ciao
Andreas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]