I remembered code Ali Çereli. It really helped: http://forum.dlang.org/thread/[email protected]#post-mihl6m:241che:241:40digitalmars.com
-----
import std.stdio, std.traits, std.range, std.algorithm;
auto deepDup(A)(A arr)
if (isArray!A)
{
static if (isArray!(ElementType!A)) {
return arr.map!(a => a.deepDup).array;
} else {
return arr.dup;
}
}
void main() {
auto s = ["foo", "bar"].deepDup;
s[1][1] = 't';
writeln(s);
}
-----
http://rextester.com/QBFH12695
P.S. Need to enable deepDup in Phobos.
