nxt.generic_array

Array container(s) with optional sortedness via template-parameter Ordering and optional use of GC via useGCAllocation.

Constructors

this
this(typeof(this) rhs)

Copy ctor moves.

this
this(R values, bool assumeSortedParameter)

Construct from InputRange values. If values are sorted assumeSortedParameter is true.

Destructor

~this
~this()

Destruct.

Members

Aliases

data
alias data = opSlice
Undocumented in source.
opDollar
alias opDollar = length
Undocumented in source.
pack
alias pack = compress

Pack/Compress storage.

prepend
alias prepend = pushFront
Undocumented in source.
put
alias put = insertBack
Undocumented in source.

Enums

isElementAssignable
eponymoustemplate isElementAssignable(U)

Is true if U can be assigned to the element type E of this.

Functions

clear
void clear()

Empty.

compress
void compress()

Pack/Compress storage.

contains
bool contains(U value)
insertAtIndex
void insertAtIndex(size_t index, Us values)

Insert element(s) values at array offset index.

insertBack
void insertBack(Us values)
void insertBack(R values)
void insertBack(A values)

Push back (append) values.

insertMany
bool[Us.length] insertMany(Us values)

Inserts several values into this ordered set.

insertMany
void insertMany(Us values)

Inserts values.

lowerBound
auto lowerBound(U e)

Wrapper for std.range.SortedRange.lowerBound when this ordering is sorted.

opAssign
void opAssign(typeof(this) rhs)

Assignment moves.

opAssign
void opAssign(typeof(null) )

Empty.

opEquals
bool opEquals(typeof(this) rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(R rhs)

Compare with range R with comparable element type.

opOpAssign
void opOpAssign(Us values)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(R values)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(A values)
Undocumented in source. Be warned that the author may not have intended to support it.
popBack
void popBack()

Removal doesn't need to care about ordering.

popBackN
void popBackN(size_t count)

Pop last count back elements.

popFront
ContainerElementType!(typeof(this), E) popFront()

Removal doesn't need to care about ordering.

pushFront
void pushFront(Us values)

Insert element(s) values at the beginning.

removeAt
ContainerElementType!(typeof(this), E) removeAt(size_t index)

Removal doesn't need to care about ordering.

reserve
size_t reserve(size_t newCapacity)

Reserve room for newCapacity.

takeBack
E takeBack()

Pop back element and return it.

toHash
hash_t toHash()

Calculate D associative array (AA) key hash.

toSortedArray
Array!(E, assignment, ordering.sortedValues, useGCAllocation, Capacity, less_) toSortedArray()
toSortedSetArray
Array!(E, assignment, ordering.sortedUniqueSet, useGCAllocation, Capacity, less_) toSortedSetArray()
upperBound
auto upperBound(U e)

Wrapper for std.range.SortedRange.upperBound when this ordering is sorted.

Properties

back
const(E) back [@property getter]

Get back element (as constant reference to preserve ordering).

back
inout(E) back [@property getter]

Get back element reference.

capacity
size_t capacity [@property getter]

Get reserved capacity of store.

dup
MutableThis dup [@property getter]
empty
bool empty [@property getter]

Check if empty.

front
const(E) front [@property getter]

Get front element (as constant reference to preserve ordering).

front
inout(E) front [@property getter]

Get front element reference.

isBorrowed
bool isBorrowed [@property getter]
isLarge
bool isLarge [@property getter]
isSmall
bool isSmall [@property getter]
length
void length [@property getter]

Set length to newLength.

length
size_t length [@property getter]

Get length.

opIndex
const(E) opIndex [@property getter]

Index operator must be const to preserve ordering.

opIndex
inout(E) opIndex [@property getter]

Index operator.

opIndexAssign
V opIndexAssign [@property setter]

Index assign operator.

opSlice
auto opSlice [@property getter]
size_t opSlice [@property setter]

Slice operator must be const when ordered.

opSlice
inout(E)[] opSlice [@property getter]

Slice operator.

opSliceAssign
void opSliceAssign(V value, size_t i, size_t j)

Slice assign operator.

ptr
inout(E*) ptr [@property getter]

Get internal pointer.

shrinkTo
void shrinkTo [@property getter]

Shrink length to newLength.

tagAsBorrowed
void tagAsBorrowed [@property getter]

Tag this borrowed. Used by wrapper logic in owned.d and borrowed.d

untagAsNotBorrowed
void untagAsNotBorrowed [@property getter]

Tag this as not borrowed. Used by wrapper logic in owned.d and borrowed.d

See Also

https://en.wikipedia.org/wiki/Sorted_array

TODO: UniqueArray!(const(E)) where E has indirections

TODO: Support for constructing from r-value range (container) of non-copyable elements.

TODO: Add some way to implement lazy sorting either for the whole array (via bool flag) or completeSort at a certain offset (extra member).

TODO: Replace = void with construction or emplace

TODO: Break out common logic into private DynamicArray and reuse with `alias this` to express StandardArray, SortedArray, SortedSetArray

TODO: Use std.array.insertInPlace in insert()? TODO: Use std.array.replaceInPlace?

TODO: Use std.algorithm.mutation.move and std.range.primitives.moveAt when moving internal sub-slices

TODO: Add c.insertAfter(r, x) where c is a collection, r is a range previously extracted from c, and x is a value convertible to collection's element type. See_Also: https://forum.dlang.org/post/n3qq6e$2bis$1@digitalmars.com

TODO: replace qcmeman with std.experimental.allocator parameter defaulting to Mallocator

TODO: use integer_sorting.radixSort when element type isSigned or isUnsigned and above or below a certain threshold calculated by my benchmarks

TODO: Remove explicit moves when DMD std.algorithm.mutation.move calls these members for us (if they exist)

https://forum.dlang.org/post/rcufngzosbbhkvevryyd@forum.dlang.org

Meta