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[] =
Operations like "ar1[] op= ar2[] op ar3[]" is only for arrays.
There is no operator overloading for this staff.
[];
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
[]) == 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?