fork download
  1. import std.stdio;
  2.  
  3. void main() {
  4.  
  5. auto c = [[[1, 2, 3], [4, 5, 6, 7, 8]],
  6. [[9, 10], [11, 12, 13]]];
  7.  
  8. auto d = [[c[0][0].dup, c[0][1].dup],
  9. [c[1][0].dup, c[1][1].dup]];
  10.  
  11. d[0][1][1 .. $ - 1] *= 3;
  12.  
  13. writeln("c = ", c);
  14. // [[[1, 2, 3], [4, 5, 6, 7, 8]],
  15. // [[9, 10], [11, 12, 13]]] // OK
  16. writeln("d = ", d);
  17. // [[[1, 2, 3], [4, 15, 18, 21, 8]],
  18. // [[9, 10], [11, 12, 13]]] // OK
  19. }
Success #stdin #stdout 0s 4120KB
stdin
Standard input is empty
stdout
c = [[[1, 2, 3], [4, 5, 6, 7, 8]], [[9, 10], [11, 12, 13]]]
d = [[[1, 2, 3], [4, 15, 18, 21, 8]], [[9, 10], [11, 12, 13]]]