On Thursday, 20 January 2022 at 22:31:17 UTC, Steven Schveighoffer wrote:

Because it would allow altering const data.


I'm not sure I understand. At what point in this function is valuesArray modified, and thus preventing it being passed in with const?

// ---

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

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

    return records.dup;
}

// ----

Reply via email to