a variable number of items, either in the form of a list or as a built-in array
Complexity: O(m), where m is the number of items.
import std.algorithm.comparison : equal; // Create a list from a list of ints { auto sl = SList!int(1, 2, 3); assert(equal(sl, [1, 2, 3])); } // Create a list from an array of ints { auto sl = SList!int([1, 2, 3]); assert(equal(sl, [1, 2, 3])); } // Create a list from a list from an input range { auto sl = SList!int(1, 2, 3); auto sl2 = SList!int(sl); assert(equal(sl2, [1, 2, 3])); }
Constructs a qualified singly linked list out of a number of items. Because no allocator was provided, the list will use the GCAllocator.std.experimental.allocator..