-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thank you Koen.

I study about std::bind (function and placeholders).  Very useful.

Now is working perfectly.

On 11/27/2012 03:18 AM, Koen Deforche wrote:
> Hey,
> 
> 2012/11/27 John Robson <john.rob...@usp.br>:
>> WPushButton* pb = new WPushButton(tr("update"));
>> pb->clicked().connect(this, &Users::listUpdate);
>>
>> If I want use Parameters inside listUpdate function:
>>
>> void Assets::listUpdate(int type, string path) { ... }
>>
>> I can't do:
>> pb->clicked().connect(this, &Users::listUpdate(1, "home"));
>>
>>
>> What I can do?  Use a WSignalMapper ? Or is there another better way?
> 
> This is the classic Wt FAQ.
> 
> The easiest way is to use learn how to use boost::bind() (or c++11
> std::bind()). It may be intimidating at first, but once you get it,
> it's a simple and versatile tool.
> 
> In your case, you would write:
> 
> pb->clicked().connect(boost::bind(&User::listUpdate, this, 1, "home"));
> 
> Roughly speaking boost::bind(F, a1, a2, a3) will call function F(a1, a2, a3).
> Buf if F is a method then the first argument a1 is actually the object
> pointer: a1->F(a2, a3).
> 
> But boost::bind() is actually a function whose result is a new
> function, in a more general way. The example above creates a function
> that accepts no parameters. You can still create a function that
> accepts parameters using placeholders _1, _2, ... Thus: boost::bind(F,
> a1, _1) will call create a function with one parameter _1 which when
> invoked, calls function F(a1, _1).
> 
> Regards,
> koen
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov


- -- 
John Robson <john.rob...@usp.br> * Universidade de São Paulo - USP
Conheça o Ubuntu: www.youtube.com/watch?v=fYbiH8lXQZM
Participe do Projeto: http://boinc.berkeley.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQtr6yAAoJEOjf7XlrDgBAeR4H/0kHcNRlKugZf1dxn7B5SWYt
DVaZ5tLn5jt+6SLR/2wh2jzfCu4LKulK/e2cxIMz7BlFgWql4YDK1BNGsAfEhmGv
ekHENcB89vLYWRuU/lb3E+CXQ9z+TapkcnRdqZPHsi7eFk9r0Go1A6FSI09jb3qr
ClxS5jljSJqFfx8vJx3EQFiqEw59Z8VtYRDjlVMN8vzR/UpTkrw8uZLsywH25CMJ
IIM0b7sZZMxYC3Q+J1nfuNlAcu8LIbxk5gBLkJJqrOyjlLMUUIsaVtmglGKEtj4Z
TWui5pNuQnuXLOQy+4bZQwX1dIcHzWJ3F39RSzy/sGdPAnSRi9cnJyl/gKRUN8o=
=ohqJ
-----END PGP SIGNATURE-----


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to