The OpenD Programming Language

TotalContainer

Undocumented in source.
struct TotalContainer (
T
) {}

Members

Aliases

KeyType
alias KeyType = T

If the container has a notion of key-value mapping, KeyType defines the type of the key of the container.

KeyTypes
alias KeyTypes = AliasSeq!T

If the container has a notion of multikey-value mapping, KeyTypes[k], where k is a zero-based unsigned number, defines the type of the kth key of the container.

ValueType
alias ValueType = T

If the container has a notion of key-value mapping, ValueType defines the type of the value of the container. Typically, a map-style container mapping values of type K to values of type V defines KeyType to be K and ValueType to be V.

Functions

clear
void clear()

Removes all contents from the container. The container decides how capacity is affected.

equalRange
Range equalRange(KeyType k)

Returns a range of all elements containing k (could be empty or a singleton range).

insert
size_t insert(Stuff stuff)

Inserts stuff in an unspecified position in the container. Implementations should choose whichever insertion means is the most advantageous for the container, but document the exact behavior. stuff can be a value convertible to the element type of the container, or a range of values convertible to it.

insertAfter
size_t insertAfter(Range r, Stuff stuff)

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

insertBack
size_t insertBack(Stuff stuff)

Inserts value to the front or back of the container. stuff can be a value convertible to the container's element type or a range of values convertible to it. 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 before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

insertFront
size_t insertFront(Stuff stuff)

Inserts value to the front or back of the container. stuff can be a value convertible to the container's element type or a range of values convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

linearInsert
size_t linearInsert(Stuff stuff)

Same as insert(stuff) and stableInsert(stuff) respectively, but relax the complexity constraint to linear.

linearRemove
Range linearRemove(Range r)

Same as remove above, but has complexity relaxed to linear.

lowerBound
Range lowerBound(KeyType k)

Returns a range of all elements with keys less than k (could be empty or a singleton range). Only defined by containers that store data sorted at all times.

moveAt
T moveAt(KeyType i)

Indexing operators yield or modify the value at a specified index.

moveBack
T moveBack()
moveFront
T moveFront()

Forward to opSlice().front and opSlice().back, respectively.

opBinary
TotalContainer opBinary(Stuff rhs)

Returns a new container that's the concatenation of this and its argument. opBinaryRight is only defined if Stuff does not define opBinary.

opBinaryRight
bool opBinaryRight(KeyType k)

k in container returns true if the given key is in the container.

opBinaryRight
TotalContainer opBinaryRight(Stuff lhs)

Returns a new container that's the concatenation of this and its argument. opBinaryRight is only defined if Stuff does not define opBinary.

opIndex
T opIndex(KeyType )
opIndexAssign
void opIndexAssign(KeyType i, T value)
opIndexOpAssign
void opIndexOpAssign(KeyType i, T value)
opIndexUnary
T opIndexUnary(KeyType i)

Indexing operators yield or modify the value at a specified index.

opOpAssign
void opOpAssign(Stuff stuff)

Forwards to insertAfter(this[], stuff).

opSlice
Range opSlice()

Returns a range that iterates over all elements of the container, in a container-defined order. The container should choose the most convenient and fast method of iteration for opSlice().

opSlice
Range opSlice(size_t a, size_t b)

Returns a range that iterates the container between two specified positions.

remove
Range remove(Range r)

Removes all elements belonging to r, which must be a range obtained originally from this container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

removeAny
T removeAny()

Picks one value in an unspecified position in the container, removes it from the container, and returns it. Implementations should pick the value that's the most advantageous for the container. 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 or back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. The optional parameter howMany instructs removal of that many elements. If howMany > n, all elements are removed and no exception is thrown.

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 or back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. The optional parameter howMany instructs removal of that many elements. If howMany > n, all elements are removed and no exception is thrown.

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.

removeKey
size_t removeKey(KeyType k)

Removes all values corresponding to key k.

replace
size_t replace(Range r, Stuff stuff)

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

reserve
void reserve(size_t e)

Ensures sufficient capacity to accommodate n elements.

stableInsert
size_t stableInsert(Stuff stuff)

Inserts stuff in an unspecified position in the container. Implementations should choose whichever insertion means is the most advantageous for the container, but document the exact behavior. stuff can be a value convertible to the element type of the container, or a range of values convertible to it.

stableInsertAfter
size_t stableInsertAfter(Range r, Stuff stuff)

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableInsertBack
size_t stableInsertBack(T value)

Inserts value to the front or back of the container. stuff can be a value convertible to the container's element type or a range of values convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableInsertBefore
size_t stableInsertBefore(Range r, Stuff stuff)

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableInsertFront
size_t stableInsertFront(Stuff stuff)

Inserts value to the front or back of the container. stuff can be a value convertible to the container's element type or a range of values convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableLinearInsert
size_t stableLinearInsert(Stuff stuff)

Same as insert(stuff) and stableInsert(stuff) respectively, but relax the complexity constraint to linear.

stableLinearRemove
Range stableLinearRemove(Range r)

Same as remove above, but has complexity relaxed to linear.

stableRemove
Range stableRemove(Range r)

Removes all elements belonging to r, which must be a range obtained originally from this container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableRemoveAny
T stableRemoveAny()

Picks one value in an unspecified position in the container, removes it from the container, and returns it. Implementations should pick the value that's the most advantageous for the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

stableRemoveBack
void stableRemoveBack()

Removes the value at the front or back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. The optional parameter howMany instructs removal of that many elements. If howMany > n, all elements are removed and no exception is thrown.

stableRemoveBack
size_t stableRemoveBack(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.

stableRemoveFront
void stableRemoveFront()

Removes the value at the front or back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. The optional parameter howMany instructs removal of that many elements. If howMany > n, all elements are removed and no exception is thrown.

stableRemoveFront
size_t stableRemoveFront(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.

stableReplace
size_t stableReplace(Range r, Stuff stuff)

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this container. stuff can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated.

upperBound
Range upperBound(KeyType k)

Returns a range of all elements with keys larger than k (could be empty or a singleton range). Only defined by containers that store data sorted at all times.

Properties

back
T back [@property getter]
T back [@property setter]

Forward to opSlice().front and opSlice().back, respectively.

capacity
size_t capacity [@property getter]

Returns the maximum number of elements the container can store without (a) allocating memory, (b) invalidating iterators upon insertion.

dup
TotalContainer dup [@property getter]

Returns a duplicate of the container. The elements themselves are not transitively duplicated.

empty
bool empty [@property getter]

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

front
T front [@property getter]
T front [@property setter]

Forward to opSlice().front and opSlice().back, respectively.

length
size_t length [@property getter]

Returns the number of elements in the container.

length
size_t length [@property setter]

Sets the number of elements in the container to newSize. If newSize is greater than length, the added elements are added to unspecified positions in the container and initialized with .init.

Structs

Range
struct Range

Defines the container's primary range, which embodies one of the ranges defined in std.range.

Meta