dup

Provide the .dup array property.

  1. V[K] dup(T aa)
  2. V[K] dup(T* aa)
  3. auto dup [@property getter]
  4. T[] dup [@property getter]
    @property
    T[]
    dup
    (
    T
    )
    (
    const(T)[] a
    )
    if (
    is(const(T) : T)
    )

Examples

auto arr = [1, 2];
auto arr2 = arr.dup;
arr[0] = 0;
assert(arr == [0, 2]);
assert(arr2 == [1, 2]);

Meta