digitalmars.D.learn - operations on rectangular arrays
- dominic jones (15/15) Nov 14 2012 Hello,
- bearophile (5/6) Nov 14 2012 2D built-in array operations are not supported. APL-style
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
Nov 14 2012
dominic jones:Is there a succinct work-around (i.e. without using foreach)?2D built-in array operations are not supported. APL-style orthogonality isn't at home in D, it seems. Bye, bearophile
Nov 14 2012