LinkedList

Simple linked list implementation. Has very good insertion speed and deletion speeds, but mediocre access.

struct LinkedList (
E
bool allowDuplicates = true
alias equal = "a == b"
) {}

Constructors

this
this(R range)

Creates a linked list from a compatible range.

Members

Aliases

opDollar
alias opDollar = length
Undocumented in source.
put
alias put = insertAtEnd
Undocumented in source.

Functions

has
bool has(E value)

Returns true if the element is found within the set.

hasRange
size_t hasRange(R range)

Returns the amount of elements found in the set.

insertAt
E insertAt(E value, size_t index)

Inserts an element at the given index.

insertAtEnd
E insertAtEnd(E value)

Inserts an element at the end of the list.

moveAt
E moveAt(size_t n)

Moves to the n-th position and returns the element of that position.

moveFront
E moveFront()

Returns the element at begin and increments the position by one.

opBinary
LinkedList!(E, allowDuplicates, equal) opBinary(R rhs)

Set operators. Enables math operations on sets, like unions and intersections. Could work on ranges in general as long as they implement some basic functions, like iteration.

opIndex
E opIndex(size_t index)

Returns the element at the given index. Will cause segfault if indexed out of bounds.

opIndex
E opIndex(size_t index)

Returns the element at the given index. Will cause segfault if indexed out of bounds.

opIndexAssign
E opIndexAssign(E value, size_t index)

Assigns an element to the index.

opOpAssign
LinkedList!(E, allowDuplicates, equal) opOpAssign(E value)

Range operators.

opOpAssign
LinkedList!(E, allowDuplicates, equal) opOpAssign(R range)

Range operators.

opOpAssign
LinkedList!(E, allowDuplicates, equal) opOpAssign(E value)

Set operators.

opOpAssign
LinkedList!(K, E, less) opOpAssign(R range)

Set operators.

opSlice
LinkedList!(E, allowDuplicates, equal) opSlice(size_t start, size_t end)

Creates a slice from the list.

popBack
void popBack()

Decrements the back iteration position by one

popFront
void popFront()

Increments the front iteration position by one

put
E put(E value)

Inserts an element at the end of the list.

remove
E remove(size_t index)

Removes the given index of the list. Return the value held at the given position

removeByElem
E removeByElem(E value)

Removes an index if the value is found. Returns the original if found, or E.init if not.

setAsFirst
E setAsFirst(size_t index)

Sets a given element to the top.

swap
void swap(size_t i0, size_t i1)

Swaps two elements.

toString
string toString()

Returns the string representation of the list.

which
size_t which(E value)

Returns the index where the element can be found, or throws an ElementNotFoundException if not found.

Properties

arrayOf
E[] arrayOf [@property getter]

Returns the elements of the list copied into an array.

back
E back [@property getter]

Returns the element at the back.

backRef
E backRef [@property getter]

Returns the element at the back.

empty
bool empty [@property getter]

Returns true when the end of the list have been reached.

front
E front [@property getter]

Returns the element at the front.

frontRef
E frontRef [@property getter]

Returns the element at the front.

length
size_t length [@property getter]

Returns the number of currently held elements within the list.

save
auto save [@property getter]

Returns a copy of this struct.

Meta