containers.slist
Singly-linked list.
License
-
Declaration
structSList(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange!T);Single-linked allocator-backed list.
Parameters
Tthe element type
Allocatorthe allocator to use. Defaults to
Mallocator.supportGCtrueif the container should support holding references to GC-allocated memory.-
Declaration
this();No default construction if an allocator must be provided.
-
Declaration
this(Allocatorallocator);Use the given
for allocations.allocator -
Declaration
inout @property autofront(this This)();Complexity: O(1)
Return Value
the most recently inserted item
-
Declaration
inout @property autoback(this This)();Complexity: O(length)
Return Value
the least recently inserted item.
-
Declaration
TmoveFront();Removes the first item in the list.
Complexity: O(1)
Return Value
the first item in the list.
-
Declaration
voidpopFront();Removes the first item in the list.
Complexity: O(1)
-
Declaration
inout pure nothrow @nogc @property @safe boolempty();Complexity: O(1)
Return Value
trueif this list isempty -
Declaration
inout pure nothrow @nogc @property @safe size_tlength();Complexity: O(1)
Return Value
the number of items in the list
-
Declaration
@trusted voidinsertFront(Tt);
aliasinsert= insertFront;
aliasinsertAnywhere= insertFront;
aliasput= insertFront;Inserts an item at the front of the list.
Complexity: O(1)
Parameters
Ttthe item to
insertinto the list -
Declaration
voidopOpAssign(string op)(Tt) if (op == "~");Supports
list ~= itemsyntaxComplexity: O(1)
-
Declaration
@trusted boolremove(V)(Vvalue);Removes the first instance of
valuefound in the list.Complexity: O(length)
Return Value
trueif avaluewas removed. -
Declaration
inout autoopSlice(this This)();Forward range interface
-
Declaration
voidclear();Removes all elements from the range
Complexity: O(length)
-