Inner.IndexMixin

index implementation

Requirements: the following symbols must be defined in the scope in which this index is mixed in:

ThisNode, Value, __InsertAllBut!N, __InsertAll, __Replace, __RemoveAllBut!N, node_count

Members

Aliases

insert
alias insert = insertBack

inserts elements of r in the back of this index. Complexity: O(n r * i(n)),
amortized O(n r) for this index

Functions

clear
void clear()

_

insertBack
size_t insertBack(SomeValue value)

inserts value in the back of this index. Complexity: O(i(n)),
amortized O(1) for this index

insertBack
size_t insertBack(SomeRange r)

inserts elements of r in the back of this index. Complexity: O(n r * i(n)),
amortized O(n r) for this index

modify
void modify(SomeRange r, Modifier mod)

Perform mod on r.front and performs any necessary fixups to container's indices. If the result of mod violates any index' invariant, r.front is removed from the container. Preconditions: !r.empty,
mod is a callable of the form void mod(ref Value) Complexity: O(m(n)),
O(1) for this index

opIndex
auto opIndex(size_t i)

Preconditions: i < length Complexity: O(1)

opIndexAssign
ValueView opIndexAssign(ValueView value, size_t i)

Sets index i to value, unless another index refuses value Preconditions: i < length

opSlice
RARange opSlice()

Fetch a range that spans all the elements in the container.

opSlice
RARange opSlice(size_t a, size_t b)

Fetch a range that spans all the elements in the container from index a (inclusive) to index b (exclusive). Preconditions: a <= b && b <= length

remove
RARange remove(Range r)

removes elements of r from this container. Complexity: O(n r * d(n)),
O(n) for this index

removeBack
void removeBack()

Removes the last element from this index. Preconditions: !empty Complexity: O(d(n));
O(1) for this index

replace
bool replace(Position!ThisNode r, ValueView value)

Replaces r.front with value

reserve
void reserve(size_t count)

Ensures sufficient capacity to accommodate count elements.

swapAt
void swapAt(size_t i, size_t j)

Swaps element at index i with element at index j. Preconditions: i < length && j < length Complexity: O(1)

Properties

back
back [@property getter]

Complexity: O(1)

back
ValueView back [@property setter]

Complexity: O(r(n));
O(1) for this index

capacity
size_t capacity [@property getter]

Returns the capacity of the index, which is the length of the underlying store

empty
bool empty [@property getter]

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

front
front [@property getter]

Complexity: O(1)

front
ValueView front [@property setter]

Complexity: O(r(n));
O(1) for this index

length
size_t length [@property getter]

Returns the number of elements in the container.

Structs

RARangeT
struct RARangeT(bool is_const)

Defines the index' primary range, which embodies a random access range

Meta