Re: Error: array operation d1[] + d2[] without assignment not implemented

2014-09-13 Thread deed via Digitalmars-d-learn
Hi! struct Vector (T) { T[]arr; T[] opSlice() { return arr; } } Vector!double v; double[] d; v[][] = d[] + d[]; //first [] call opSlise, second [] for array syntax Best Regards, Ilya Thanks for your suggestion. It's not as attractive though, it would be the same as v.arr[] =

Re: Error: array operation d1[] + d2[] without assignment not implemented

2014-09-13 Thread Ilya Yaroshenko via Digitalmars-d-learn
Operations like "ar1[] op= ar2[] op ar3[]" is only for arrays. There is no operator overloading for this staff.

Re: Error: array operation d1[] + d2[] without assignment not implemented

2014-09-13 Thread Ilya Yaroshenko via Digitalmars-d-learn
[]; assert (d3 == [11.+21., 12.+22.]); assert (is(typeof(d1[] + d2[]) == double[])); v[] = d1[] // Fine v[] = d1[] + d2[]; // Error: array operation d1[] + d2[] without assignment not implemented } How can opSliceAssign be defined to make this work? Hi! struct Vector (T) { T

Error: array operation d1[] + d2[] without assignment not implemented

2014-09-13 Thread deed via Digitalmars-d-learn
[]) == double[])); v[] = d1[] // Fine v[] = d1[] + d2[]; // Error: array operation d1[] + d2[] without assignment not implemented } How can opSliceAssign be defined to make this work?