I`ve just started learning d and have a question.
What should I write to set dinamyc rectangular array length in both dimentions?
For example, I have declareted an array:
int[][] matrix;
and want set it as n*n matrix.
Thanks
Thread overview | |||||
---|---|---|---|---|---|
|
September 17, 2023 Dinamyc arrays | ||||
---|---|---|---|---|
| ||||
September 17, 2023 Re: Dinamyc arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timofey | On Sunday, 17 September 2023 at 17:15:34 UTC, Timofey wrote: >I`ve just started learning d and have a question. There are many ways to do this, but I can quickly show you two:
SDB@79 |
September 17, 2023 Re: Dinamyc arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timofey | On Sunday, 17 September 2023 at 17:15:34 UTC, Timofey wrote: >I`ve just started learning d and have a question.
and want set it as n*n matrix. You can flatten the mat and use operator overloads. Here's a some basic code to get started:
Those kind of type should already exist in 3rd part native D libraries, e.g "MIR" has something called "NDSlice" IIRC. |