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.
a new list.
Complexity: O(n).
import std.algorithm.comparison : equal; auto stuff = [1, 2, 3]; auto sl = immutable SList!int(stuff); auto slDup = sl.dup; assert(equal(slDup, stuff)); slDup.front = 0; assert(slDup.front == 0); assert(sl.front == 1);
See Implementation
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.