View source code
Display the source code in std/container/slist.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Struct std.container.slist.SList
Implements a simple and fast singly-linked list. It can be used as a stack.
struct SList(T)
if (!is(T == shared));
SList
uses reference semantics.
Constructors
Name | Description |
---|---|
this
|
Constructor taking a number of nodes |
this
|
Constructor taking an input range |
Properties
Name | Type | Description |
---|---|---|
dup [get]
|
SList | Duplicates the container. The elements themselves are not transitively duplicated. |
empty [get]
|
bool | Property returning true if and only if the container has no
elements.
|
front [get]
|
T | Forward to opSlice() .
|
Methods
Name | Description |
---|---|
clear
|
Removes all contents from the SList .
|
insertAfter
|
Inserts stuff after range r , which must be a range
previously extracted from this container. Given that all ranges for a
list end at the end of the list, this function essentially appends to
the list and uses r as a potentially fast way to reach the last
node in the list. Ideally r is positioned near or at the last
element of the list.
|
insertAfter
|
Similar to insertAfter above, but accepts a range bounded in
count. This is important for ensuring fast insertions in the middle of
the list. For fast insertions after a specified position r , use
insertAfter(take(r, 1), stuff) . The complexity of that operation
only depends on the number of elements in stuff .
|
insertFront
|
Inserts stuff to the front of the container. stuff can be a
value convertible to T or a range of objects convertible to T . The stable version behaves the same, but guarantees that ranges
iterating over the container are never invalidated.
|
linearRemove
|
Removes a range from the list in linear time. |
linearRemove
|
Removes a Take!Range from the list in linear time.
|
linearRemoveElement
|
Removes the first occurence of an element from the list in linear time. |
opBinary
|
Returns a new SList that's the concatenation of this and its
argument. opBinaryRight is only defined if Stuff does not
define opBinary .
|
opBinaryRight
|
Returns a new SList that's the concatenation of this and its
argument. opBinaryRight is only defined if Stuff does not
define opBinary .
|
opEquals
|
Comparison for equality. |
opSlice
|
Returns a range that iterates over all elements of the container, in forward order. |
removeAny
|
Picks one value in an unspecified position in the container, removes it from the container, and returns it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. |
removeFront
|
Removes the value at the front of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. |
removeFront
|
Removes howMany values at the front or back of the
container. Unlike the unparameterized versions above, these functions
do not throw if they could not remove howMany elements. Instead,
if howMany > n , all elements are removed. The returned value is
the effective number of elements removed. The stable version behaves
the same, but guarantees that ranges iterating over the container are
never invalidated.
|
reverse
|
Reverses SList in-place. Performs no memory allocation. |
Inner structs
Name | Description |
---|---|
Range
|
Defines the container's primary range, which embodies a forward range. |
Aliases
Name | Description |
---|---|
insert
|
Inserts stuff to the front of the container. stuff can be a
value convertible to T or a range of objects convertible to T . The stable version behaves the same, but guarantees that ranges
iterating over the container are never invalidated.
|
stableInsert
|
Inserts stuff to the front of the container. stuff can be a
value convertible to T or a range of objects convertible to T . The stable version behaves the same, but guarantees that ranges
iterating over the container are never invalidated.
|
stableInsertAfter
|
Similar to insertAfter above, but accepts a range bounded in
count. This is important for ensuring fast insertions in the middle of
the list. For fast insertions after a specified position r , use
insertAfter(take(r, 1), stuff) . The complexity of that operation
only depends on the number of elements in stuff .
|
stableInsertFront
|
Inserts stuff to the front of the container. stuff can be a
value convertible to T or a range of objects convertible to T . The stable version behaves the same, but guarantees that ranges
iterating over the container are never invalidated.
|
stableLinearRemove
|
Removes a Take!Range from the list in linear time.
|
stableRemoveAny
|
Picks one value in an unspecified position in the container, removes it from the container, and returns it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. |
stableRemoveFront
|
Removes the value at the front of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. |
stableRemoveFront
|
Removes howMany values at the front or back of the
container. Unlike the unparameterized versions above, these functions
do not throw if they could not remove howMany elements. Instead,
if howMany > n , all elements are removed. The returned value is
the effective number of elements removed. The stable version behaves
the same, but guarantees that ranges iterating over the container are
never invalidated.
|
Authors
License
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ).
Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.