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

2016-04-22 Thread Dsby via Digitalmars-d-learn
On Friday, 18 March 2016 at 17:24:27 UTC, Ali Çehreli wrote: On 03/18/2016 03:50 AM, 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(

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

2016-03-19 Thread Ali Çehreli via Digitalmars-d-learn
On 03/18/2016 09:14 AM, Dsby wrote: On Friday, 18 March 2016 at 11:09:37 UTC, Atila Neves wrote: 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

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

2016-03-19 Thread Atila Neves via Digitalmars-d-learn
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

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

2016-03-19 Thread Marc Schütz via Digitalmars-d-learn
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

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

2016-03-19 Thread Dsby via Digitalmars-d-learn
On Friday, 18 March 2016 at 17:31:11 UTC, Ali Çehreli wrote: On 03/18/2016 09:14 AM, Dsby wrote: [...] Here is one that puts 'shared' in a lot of places: import std.stdio; import std.concurrency; [...] thanks.

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

2016-03-19 Thread Dsby via Digitalmars-d-learn
On Friday, 18 March 2016 at 11:09:37 UTC, Atila Neves wrote: 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 = ",

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

2016-03-19 Thread Ali Çehreli via Digitalmars-d-learn
On 03/18/2016 03:50 AM, 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

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

2016-03-18 Thread Dsby via Digitalmars-d-learn
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.