View source code
Display the source code in std/container/dlist.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.dlist.DList

Implements a doubly-linked list.

struct DList(T) ;

DList uses reference semantics.

Constructors

NameDescription
this () Constructor taking a number of nodes
this (stuff) Constructor taking an input range

Properties

NameTypeDescription
back[get] inout(T)Forward to opSlice().back.
dup[get] DListDuplicates the container. The elements themselves are not transitively duplicated.
empty[get] boolProperty returning true if and only if the container has no elements.
front[get] inout(T)Forward to opSlice().front.

Methods

NameDescription
clear () Removes all contents from the DList.
insertAfter (r, stuff) Inserts stuff after range r, which must be a non-empty range previously extracted from this container.
insertBack (stuff) Inserts stuff to the front/back 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.
insertBefore (r, stuff) Inserts stuff after range r, which must be a non-empty range previously extracted from this container.
insertFront (stuff) Inserts stuff to the front/back 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 (r) Removes all elements belonging to r, which must be a range obtained originally from this container.
linearRemove (r) linearRemove functions as remove, but also accepts ranges that are result the of a take operation. This is a convenient way to remove a fixed amount of elements from the range.
linearRemoveElement (value) Removes the first occurence of an element from the list in linear time.
opBinary (rhs) Returns a new DList that's the concatenation of this and its argument rhs.
opBinaryRight (lhs) Returns a new DList that's the concatenation of the argument lhs and this.
opEquals (rhs) Comparison for equality.
opOpAssign (rhs) Appends the contents of the argument rhs into this.
opSlice () Returns a range that iterates over all elements of the container, in forward order.
popFirstOf (r) Removes first element of r, wich must be a range obtained originally from this container, from both DList instance and range r.
popLastOf (r) Removes last element of r, wich must be a range obtained originally from this container, from both DList instance and range r.
remove (r) Removes all elements belonging to r, which must be a range obtained originally from this container.
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.
removeBack () Removes the value at the front/back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.
removeBack (howMany) 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.
removeFront () Removes the value at the front/back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.
removeFront (howMany) 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.

Inner structs

NameDescription
Range Defines the container's primary range, which embodies a bidirectional range.

Aliases

NameDescription
insert Inserts stuff to the front/back 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/back 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 Inserts stuff after range r, which must be a non-empty range previously extracted from this container.
stableInsertBack Inserts stuff to the front/back 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.
stableInsertBefore Inserts stuff after range r, which must be a non-empty range previously extracted from this container.
stableInsertFront Inserts stuff to the front/back 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 linearRemove functions as remove, but also accepts ranges that are result the of a take operation. This is a convenient way to remove a fixed amount of elements from the range.
stableRemove Removes all elements belonging to r, which must be a range obtained originally from this container.
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.
stableRemoveBack Removes the value at the front/back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.
stableRemoveBack 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.
stableRemoveFront Removes the value at the front/back 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

Andrei Alexandrescu

License

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ).