DList.dup

Perform a copy of the list. This will create a new list that will copy the elements of the current list. This will NOT call dup on the elements of the list, regardless if T defines it or not.

struct DList(T)
typeof(this)
dup
()

Return Value

Type: typeof(this)

a new list.

Complexity: O(n).

Examples

import std.algorithm.comparison : equal;

auto dl = DList!int(1, 2, 3);
auto dlDup = dl.dup;
assert(equal(dl, dlDup));
dlDup.front = 0;
assert(!equal(dl, dlDup));
assert(dlDup.front == 0);
assert(dl.front == 1);

Meta