Iterating over multiple collections in parallel
Manfred_Nowak
svv1999 at hotmail.com
Sat Jul 5 14:45:08 PDT 2008
Koroskin Denis wrote:
> int[] c = new int[a.length];
> foreach (i : a; j : b; ref k : c) {
> k = a + b;
> }
What's wrong with
auto c= a .* b;
except, that it is neither suggested nor supported?
Or
auto c= a (*) b;
which was suggested some long time ago, but has not got through?
Is it horrible then to define:
void opDotMul(T)(out T c, T x, T y){
assert( x.length == y.length);
c.length= x.length;
foreach( i,v; x){
c[i]= x[i] * y[i];
}
}
-manfred
More information about the Digitalmars-d
mailing list