November 14, 2012 operations on rectangular arrays | ||||
---|---|---|---|---|
| ||||
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 |
November 14, 2012 Re: operations on rectangular arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to dominic jones | 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
|
Copyright © 1999-2021 by the D Language Foundation