automate tuple creation

forkit forkit at gmail.com
Thu Jan 20 22:07:14 UTC 2022


On Thursday, 20 January 2022 at 21:16:46 UTC, forkit wrote:
>

Cannot work out why I cannot pass valuesArray in as ref const??

get error: Error: cannot append type `const(int[])[const(int)]` 
to type `int[][int][]`


// --

int[][int][] CreateDataSet(ref const int[] idArray, ref 
const(int[][]) valuesArray, const int numRecords)
{
     int[][int][] records;
     records.reserve(numRecords);

     foreach(i, id; idArray)
         records ~= [ idArray[i] : valuesArray[i] ];

     return records.dup;
}

// ---


More information about the Digitalmars-d-learn mailing list