The OpenD Programming Language

DList

Implements a doubly-linked list.

DList uses reference semantics.

Constructors

this
this(U[] values)

Constructor taking a number of nodes

this
this(Stuff stuff)

Constructor taking an input range

Members

Aliases

insert
alias insert = insertBack
stableInsert
alias stableInsert = 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.

stableInsertAfter
alias stableInsertAfter = insertAfter

Inserts stuff after range r, which must be a non-empty range previously extracted from this container.

stableInsertBack
alias stableInsertBack = insertBack

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
alias stableInsertBefore = insertBefore

Inserts stuff after range r, which must be a non-empty range previously extracted from this container.

stableInsertFront
alias stableInsertFront = insertFront

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
alias stableLinearRemove = linearRemove

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
alias stableRemove = remove

Removes all elements belonging to r, which must be a range obtained originally from this container.

stableRemoveAny
alias stableRemoveAny = 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.

stableRemoveBack
alias stableRemoveBack = 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.

stableRemoveBack
alias stableRemoveBack = removeBack

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
alias stableRemoveFront = 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.

stableRemoveFront
alias stableRemoveFront = 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.

Functions

clear
void clear()

Removes all contents from the DList.

empty
bool empty()

Property returning true if and only if the container has no elements.

insertAfter
size_t insertAfter(Range r, Stuff stuff)

Inserts stuff after range r, which must be a non-empty range previously extracted from this container.

insertBack
size_t insertBack(Stuff 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
size_t insertBefore(Range r, Stuff stuff)

Inserts stuff after range r, which must be a non-empty range previously extracted from this container.

insertFront
size_t insertFront(Stuff 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
Range linearRemove(Range r)

Removes all elements belonging to r, which must be a range obtained originally from this container.

linearRemove
Range linearRemove(Take!Range 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
bool linearRemoveElement(T value)

Removes the first occurence of an element from the list in linear time.

opBinary
DList opBinary(Stuff rhs)

Returns a new DList that's the concatenation of this and its argument rhs.

opBinaryRight
DList opBinaryRight(Stuff lhs)

Returns a new DList that's the concatenation of the argument lhs and this.

opEquals
bool opEquals(DList rhs)

Comparison for equality.

opOpAssign
DList opOpAssign(Stuff rhs)

Appends the contents of the argument rhs into this.

opSlice
Range opSlice()

Returns a range that iterates over all elements of the container, in forward order.

popFirstOf
void popFirstOf(Range r)

Removes first element of r, wich must be a range obtained originally from this container, from both DList instance and range r.

popLastOf
void popLastOf(Range r)

Removes last element of r, wich must be a range obtained originally from this container, from both DList instance and range r.

remove
Range remove(Range r)

Removes all elements belonging to r, which must be a range obtained originally from this container.

removeAny
T 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
void 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
size_t removeBack(size_t 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
void 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
size_t removeFront(size_t 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.

Properties

back
inout(T) back [@property getter]

Forward to opSlice().back.

dup
DList dup [@property getter]

Duplicates the container. The elements themselves are not transitively duplicated.

front
inout(T) front [@property getter]

Forward to opSlice().front.

Structs

Range
struct Range

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

Meta