Array

Array specialized for bool. Packs together values efficiently by allocating one bit per element.

  1. struct Array(T)
  2. struct Array(T)
    struct Array (
    T
    ) if (
    is(immutable T == immutable bool)
    ) {
    static immutable
    uint bitsPerWord;
    }

Constructors

this
this(U[] values)

Constructor taking a number of items.

this
this(Range r)

Constructor taking an input range

Members

Aliases

insert
alias insert = insertBack
linearInsert
alias linearInsert = insertBack
stableInsert
alias stableInsert = insertBack

Inserts the specified elements at the back of the array. stuff can be a value convertible to bool or a range of objects convertible to bool.

stableInsertAfter
alias stableInsertAfter = insertAfter

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

stableInsertBack
alias stableInsertBack = insertBack

Inserts the specified elements at the back of the array. stuff can be a value convertible to bool or a range of objects convertible to bool.

stableInsertBefore
alias stableInsertBefore = insertBefore

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

stableLinearInsert
alias stableLinearInsert = insertBack

Inserts the specified elements at the back of the array. stuff can be a value convertible to bool or a range of objects convertible to bool.

stableRemoveAny
alias stableRemoveAny = removeAny

Removes the last element from the array and returns it. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

stableRemoveBack
alias stableRemoveBack = removeBack

Removes the value from the back of the array. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

stableRemoveBack
alias stableRemoveBack = removeBack

Removes howMany values from the back of the array. 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. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

stableReplace
alias stableReplace = replace

Inserts stuff before, after, or instead range r, which must be a valid range previously extracted from this array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

Functions

clear
void clear()

Removes all the elements from the array and releases allocated memory.

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 array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

insertBack
size_t insertBack(Stuff stuff)

Inserts the specified elements at the back of the array. stuff can be a value convertible to bool or a range of objects convertible to bool.

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 array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

linearRemove
Range linearRemove(Range r)

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

moveAt
T moveAt(size_t i)

Indexing operators yielding or modifyng the value at the specified index.

opBinary
Array!bool opBinary(Stuff rhs)
opIndex
bool opIndex(size_t i)
opIndexAssign
void opIndexAssign(bool value, size_t i)
opIndexOpAssign
void opIndexOpAssign(bool value, size_t i)

Indexing operators yielding or modifyng the value at the specified index.

opOpAssign
Array!bool opOpAssign(Stuff stuff)

Forwards to insertBack.

opSlice
Range opSlice()
opSlice
Range opSlice(size_t a, size_t b)
removeAny
T removeAny()

Removes the last element from the array and returns it. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

removeBack
void removeBack()

Removes the value from the back of the array. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

removeBack
size_t removeBack(size_t howMany)

Removes howMany values from the back of the array. 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. Both stable and non-stable versions behave the same and guarantee that ranges iterating over the array are never invalidated.

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 array. stuff can be a value convertible to bool or a range of objects convertible to bool. Both stable and non-stable version behave the same and guarantee that ranges iterating over the array are never invalidated.

reserve
void reserve(size_t e)

Ensures sufficient capacity to accommodate e _elements. If e < capacity, this method does nothing.

Properties

back
bool back [@property getter]
bool back [@property setter]
capacity
size_t capacity [@property getter]
dup
Array dup [@property getter]
empty
bool empty [@property getter]

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

front
bool front [@property getter]
bool front [@property setter]
length
size_t length [@property getter]

Returns the number of elements in the array.

length
size_t length [@property setter]

Sets the number of elements in the array to newLength. If newLength is greater than length, the new elements are added to the end of the array and initialized with false.

Structs

Range
struct Range

Defines the array's primary range.

Meta