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)

@safe pure
struct FixedArray (
T
uint capacity_
bool borrowChecked = false
) {}

Constructors

this
this(Us values)

Construct from element values.

this
this(U[] values)

Construct from element values.

Destructor

~this
~this()

Destruct.

Members

Aliases

Length
alias Length = ubyte
Undocumented in source.
Length
alias Length = ushort
Undocumented in source.
Length
alias Length = ubyte
Undocumented in source.
Length
alias Length = uint
Undocumented in source.
Length
alias Length = uint
Undocumented in source.
Length
alias Length = uint
Undocumented in source.
capacity
alias capacity = capacity_
Undocumented in source.
opDollar
alias opDollar = length
Undocumented in source.
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.

front
inout(T) front()

First (front) element.

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

moveAt
T moveAt(size_t index)

Move element at index to return.

opEquals
bool opEquals(U[] rhs)

Comparison for equality.

opEquals
bool opEquals(typeof(this) 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.

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.

Manifest constants

readBorrowCountMax
enum readBorrowCountMax;

Maximum value possible for _readBorrowCount.

Properties

empty
bool empty [@property getter]
full
bool full [@property getter]
isBorrowed
bool isBorrowed [@property getter]
isWriteBorrowed
bool isWriteBorrowed [@property getter]
length
auto length [@property getter]

Get length.

readBorrowCount
uint readBorrowCount [@property getter]
toString
const(T)[] toString [@property getter]

Get as string.

Static functions

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

Construct from element values.

Variables

_length
Length _length;

number of defined elements in _store

_store
T[capacity] _store;

Store of capacity number of elements.

Meta