struct construct with array

2011-03-12 Thread Caligo
struct Test{ public double[3] ar_; this(double[3] ar){ this.ar_ = ar; } } void main(){ double[3] v1 = [1.0, 2.0, 3.0]; double[3] v2 = [2.0, 3.0, 4.0]; auto t1 = Test(v1[0..$] + v2[0..$]); // error } I want to add those two arrays and call the constructor in one line, but

Re: struct construct with array

2011-03-12 Thread Andrej Mitrovic
The best thing I can think of is introducing a temp variable: void main(){ double[3] v1 = [1.0, 2.0, 3.0]; double[3] v2 = [2.0, 3.0, 4.0]; double[3] v3 = v1[] + v2[]; auto t1 = Test(v3); }

Re: struct construct with array

2011-03-12 Thread Ali Çehreli
On 03/12/2011 10:42 AM, Caligo wrote: struct Test{ public double[3] ar_; this(double[3] ar){ this.ar_ = ar; } } void main(){ double[3] v1 = [1.0, 2.0, 3.0]; double[3] v2 = [2.0, 3.0, 4.0]; auto t1 = Test(v1[0..$] + v2[0..$]); // error } I want to add those two

Re: struct construct with array

2011-03-12 Thread Ali Çehreli
On 03/12/2011 02:52 PM, Ali Çehreli wrote: On 03/12/2011 10:42 AM, Caligo wrote: struct Test{ public double[3] ar_; this(double[3] ar){ this.ar_ = ar; } } void main(){ double[3] v1 = [1.0, 2.0, 3.0]; double[3] v2 = [2.0, 3.0, 4.0]; auto t1 = Test(v1[0..$] + v2[0..$]); // error } I want