``` import std.stdio; void main(){ auto a=new int[][] (0,0); a~=[1,2]; a~=[3,4]; auto b= a.dup; a[0]=[5,6]; a[1][1]=7; writeln(b); } ```
Program above outputs [[1, 2], [3, 7]] Which means a[1][1] and b[1][1] point to the same memory location. But a[0] occupies a different memory location as b[0]. It is a shallow copy and is the expected behaviour. Maybe there is need for a library function dupdeep ?