deepCopy

Ditto, but allocates new buffer each time called

  1. S deepCopy(S src, void[] dst)
  2. S deepCopy(S src)
    S
    deepCopy
    (
    S
    )
    (
    ref S src
    )

Examples

struct Test
{
    int[] arr;
}

auto s1 = Test([ 1, 2, 3 ]);
auto s2 = deepCopy(s1);

test!("==")(s1.arr, s2.arr);
test!("!is")(s1.arr.ptr, s2.arr.ptr);

Meta