Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Paul Backus via Digitalmars-d-learn
On Monday, 17 February 2020 at 20:08:24 UTC, Adnan wrote: On Monday, 17 February 2020 at 14:34:44 UTC, Simen Kjærås wrote: On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: // All in all, I end up with this code: module strassens_matmul package { T[][] mulIterative(T)(const

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
On Monday, 17 February 2020 at 14:34:44 UTC, Simen Kjærås wrote: On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: // All in all, I end up with this code: module strassens_matmul package { T[][] mulIterative(T)(const T[][] mat1, const T[][] mat2) { auto result =

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: cdsa ~master: building configuration "cdsa-test-library"... source/strassens_matmul.d(22,16): Error: cannot implicitly convert expression [row][column] of type const(uint)* to uint* source/strassens_matmul.d(37,36): Error: template

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote: On Monday, 17 February 2020 at 13:44:55 UTC, Adnan wrote: [...] Okay I changed to module strassens_matmul; [...] I changed getPointPtr to following and now it works /// row and column are 0 index-based void assign(T)(ref

Re: Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
On Monday, 17 February 2020 at 13:44:55 UTC, Adnan wrote: https://ideone.com/lVi5Uy module strassens_matmul; debug { static import std; } ... Okay I changed to module strassens_matmul; debug { static import std; } package { ulong getRowSize(T)(scope const T[][] mat) {

Why can't I pass a const array to a function that takes scope const arrays?

2020-02-17 Thread Adnan via Digitalmars-d-learn
https://ideone.com/lVi5Uy module strassens_matmul; debug { static import std; } package { ulong getRowSize(T)(T[][] mat) { return mat[0].length; } ulong getColumnSize(T)(T[][] mat) { return mat.length; } T[][] createMatrix(T)(const ulong rowSize, const