y = Marshal.load(Marshal.dump(x))
integer, allocatable, dimension(:,:) :: y
y = x
buf := make([]T, m*n)
y = make([][]T, m)
for i := range y {
y[i] = buf[:n:n]
buf = buf[n:]
copy(y[i], x[i])
}
func clone2D[M ~[][]T, T any](in M) (out M) {
if len(in) == 0 {
return nil
}
m, n := len(in), len(in[0])
buf := make([]T, m*n)
out = make(M, m)
for i := range out {
out[i] = buf[:n:n]
buf = buf[n:]
copy(out[i], in[i])
}
return out
}
Class<?> c = x.getClass(),
a = c.getComponentType(),
b = a.getComponentType();
int i, m = x.length, n;
T y[][] = (T[][]) newInstance(a, m), Y[], t[];
for (i = 0; i < m; ++i) {
n = (t = x[i]).length;
Y = (T[]) newInstance(b, n);
arraycopy(t, 0, Y, 0, n);
y[i] = Y;
}
int i, m = x.length, n,
y[][] = new int[m][], Y[], t[];
for (i = 0; i < m; ++i) {
n = (t = x[i]).length;
Y = new int[n];
arraycopy(t, 0, Y, 0, n);
y[i] = Y;
}
int i, m = x.length, n,
y[][] = new int[m][], t[];
for (i = 0; i < m; ++i) {
n = (t = x[i]).length;
y[i] = copyOf(t, n);
}
y := copy(x, Low(x), Length(x));