Re: Delegate function access to classes local variable

2013-11-10 Thread Timon Gehr
On 11/10/2013 09:03 PM, Colin Grogan wrote: For example, Column!(int, int) randonNumberColumn = new Column!(int, int)((ref m)=>to!string(uniform(m.vars[0], m.vars[1])), 1, 10); will work. However, Column!(int, int) incrementalNumberColumn = new Column!(int, int)((ref m)=>{m.vars[0]+=m.

Re: Delegate function access to classes local variable

2013-11-10 Thread Colin Grogan
On Friday, 8 November 2013 at 13:19:05 UTC, Colin Grogan wrote: On Friday, 8 November 2013 at 13:14:33 UTC, Timon Gehr wrote: On 11/08/2013 01:43 PM, Colin Grogan wrote: Hi folks, I'm having some issue getting a delegate function access to a classes member variable. At object construct time

Re: Delegate function access to classes local variable

2013-11-08 Thread Colin Grogan
On Friday, 8 November 2013 at 13:14:33 UTC, Timon Gehr wrote: On 11/08/2013 01:43 PM, Colin Grogan wrote: Hi folks, I'm having some issue getting a delegate function access to a classes member variable. At object construct time, I'm passing in a delegate function, and a list of parameters

Re: Delegate function access to classes local variable

2013-11-08 Thread Colin Grogan
On Friday, 8 November 2013 at 13:10:10 UTC, Dicebot wrote: On Friday, 8 November 2013 at 12:43:37 UTC, Colin Grogan wrote: import std.stdio; void main() { Column!string col1 = new Column!string( {return "test"; }, "Hello, "); Column!string col2 = new Column!string( {return vars[0]; }, "World

Re: Delegate function access to classes local variable

2013-11-08 Thread Timon Gehr
On 11/08/2013 01:43 PM, Colin Grogan wrote: Hi folks, I'm having some issue getting a delegate function access to a classes member variable. At object construct time, I'm passing in a delegate function, and a list of parameters after. The parameters are saved to a variable called vars. Should I

Re: Delegate function access to classes local variable

2013-11-08 Thread Dicebot
On Friday, 8 November 2013 at 12:43:37 UTC, Colin Grogan wrote: import std.stdio; void main() { Column!string col1 = new Column!string( {return "test"; }, "Hello, "); Column!string col2 = new Column!string( {return vars[0]; }, "World"); // Compilation fail!! Delegate cant see vars[0]