operations on rectangular arrays

dominic jones dominic.jones at gmx.co.uk
Wed Nov 14 03:35:27 PST 2012


Hello,

This code snippet:
   int[][] A = [[1, 2], [2, 3]];
   int[][] B = [[2, 3], [1, 2]];
   int[2][2] C;
   C = A[][] + B[][];

fails with the message:
   "Error: cannot implicitly convert expression (A[][] + B[][]) of 
type int[][] to int[2LU][]"

Is there a succinct work-around (i.e. without using foreach)? And 
will such statements one day be possible?

The section in http://dlang.org/arrays.html on rectangular arrays 
offers no use cases to follow.

Thank you,
Dominic Jones



More information about the Digitalmars-d-learn mailing list