How to copy a const multi-dimensional array to mutable?
ixid
nuaccount at gmail.com
Sat Sep 15 21:47:20 PDT 2012
This doesn't work:
const int[4][4] a = [[10,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]];
int[4][4] b = a.dup;
Error: cannot implicitly convert expression (_adDupT(&
D15TypeInfo_xG4G4i6__initZ,cast(const(int[4u])[])a)) of type
int[4u][] to int[]
And with dynamic arrays:
Error: cannot implicitly convert expression (_adDupT(&
D13TypeInfo_xAAi6__initZ,a)) of type const(int)[][] to int[][]
This does:
const int[4] c = [10,0,0,0];
int[4] d = c.dup;
Shouldn't dup do the former as well and if not how should it be
done?
More information about the Digitalmars-d-learn
mailing list