Whitch can replace std::bind/boost::bind ?

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 18 07:33:44 PDT 2016


On Friday, 18 March 2016 at 10:50:34 UTC, Dsby wrote:
>
> foreach (i ; 0..4) {
> 	auto th = new Thread(delegate(){listRun(i);});//this is erro
> 	_thread[i]= th;
> 	th.start();
> }
>
> void listRun(int i)
> {
>      writeln("i = ", i); // the value is not(0,1,2,3), it all 
> is 2.
> }
>
>
> I want to know how to use it like std::bind.

This is a bug in the compiler:
https://issues.dlang.org/show_bug.cgi?id=2043


More information about the Digitalmars-d-learn mailing list