FixedArray

Statically allocated T-array of fixed pre-allocated length.

Similar to Rust's fixedvec: https://docs.rs/fixedvec/0.2.3/fixedvec/ Similar to mir.small_array at http://mir-algorithm.libmir.org/mir_small_array.html.

TODO Merge member functions with basic_*_array.d and array_ex.d

TODO Add @safe nothrow @nogc ctor from static array (of known length)

TODO use opPostMove (https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1014.md)

Constructors

this
this(Us values)

Construct from element values.

this
this(U[] values)

Construct from element values.

Destructor

~this
~this()

Destruct.

Members

Aliases

put
alias put = insertBack

Add elements es to the back. Throws when array becomes full. NOTE doesn't invalidate any borrow

putMaybe
alias putMaybe = insertBackMaybe

Try to add elements es to the back. NOTE doesn't invalidate any borrow

Functions

back
inout(T) back()

Last (back) element.

empty
bool empty()
front
inout(T) front()

First (front) element.

full
bool full()
insertBack
void insertBack(Es es)

Add elements es to the back. Throws when array becomes full. NOTE doesn't invalidate any borrow

insertBackMaybe
bool insertBackMaybe(Es es)

Try to add elements es to the back. NOTE doesn't invalidate any borrow

isBorrowed
bool isBorrowed()
isWriteBorrowed
bool isWriteBorrowed()
length
auto length()

Get length.

opEquals
bool opEquals(typeof(this) rhs)
bool opEquals(U[] rhs)

Comparison for equality.

opIndex
inout(T) opIndex(size_t i)

Index operator.

opOpAssign
void opOpAssign(Us values)

Add elements es to the back. NOTE doesn't invalidate any borrow

opSlice
auto opSlice(size_t i, size_t j)

Get read-only slice in range i .. j.

opSlice
auto opSlice(size_t i, size_t j)

Get read-write slice in range i .. j.

opSlice
auto opSlice()

Get read-only full slice.

opSlice
auto opSlice()

Get read-write full slice.

opSlice
inout(T)[] opSlice(size_t i, size_t j)

Get slice in range i .. j.

opSlice
inout(T)[] opSlice()

Get full slice.

popAt
void popAt(size_t index)

Pop element at index.

popBack
void popBack()

Pop last (back) element.

popBackN
void popBackN(size_t n)

Pop the n last (back) elements.

popFront
auto ref popFront()

Pop first (front) element.

readBorrowCount
uint readBorrowCount()
sliceRO
ReadBorrowed!(T[], typeof(this)) sliceRO()

Get full read-only slice.

sliceRO
ReadBorrowed!(T[], typeof(this)) sliceRO(size_t i, size_t j)

Get read-only slice in range i .. j.

sliceRW
WriteBorrowed!(T[], typeof(this)) sliceRW()

Get full read-write slice.

sliceRW
WriteBorrowed!(T[], typeof(this)) sliceRW(size_t i, size_t j)

Get read-write slice in range i .. j.

toString
const(T)[] toString()

Get as string.

Manifest constants

readBorrowCountMax
enum readBorrowCountMax;

Maximum value possible for _readBorrowCount.

Static functions

fromValuesUnsafe
typeof(this) fromValuesUnsafe(U[] values)

Construct from element values.

Variables

_store
T[capacity] _store;

Store of capacity number of elements.

Meta