containers.fixedarray
Fixed-size array struct.
- struct FixedArray(T,Allocator = DirectAllocator) if (Allocator.canAllocate!(T));
Simple fixed-size array with manually managed memory, with interface similar to D array.
- T[] data_;
Manually allocated data storage.
- this(const size_t length);
Construct a FixedArray with specified length.
- void opAssign(FixedArray rhs);
Assign to another array. This will destroy any data owned by this array and copy data to this array.
Parameters:v Vector to assign. - const @trusted hash_t toHash();
Compute a hash.
- int opApply(int delegate(ref T) dg);
Foreach over values.
Foreach will iterate over all elements of the array in linear order from start to end.
- int opApply(int delegate(ref size_t, ref T) dg);
Foreach over indices and values.
Foreach will iterate over all elements of the array in linear order from start to end.
- inout pure nothrow inout(T) opIndex(const size_t index);
Get element at the specified index.
Parameters:Returns:size_t index Index of the element to get. Must be within bounds. Element at the specified index.- void opIndexAssign(T value, const size_t index);
Set element at the specified index.
This method only exists if T is copyable.
Parameters:size_t index Index of the element to set. Must be within bounds. - void opSliceAssign(T[] array, const size_t start, const size_t end);
Assign a slice of the array from a D array.
This method only exists if T is copyable.
Parameters:T[] array Array to assign to. size_t start Start of the slice. size_t end End of the slice. - inout pure nothrow inout(T[]) opSlice(const size_t start, const size_t end);
Get a slice of the array as a D array.
Parameters:size_t start Start of the slice. size_t end End of the slice. - inout pure nothrow inout(T)[] opSlice();
Get a slice of the whole array as a D array.
- inout pure nothrow inout(T) front();
Access the first element of the array.
- inout pure nothrow inout(T) back();
Access the last element of the array.
- const pure nothrow size_t length();
Get number of elements in the array.
- const pure nothrow bool empty();
- void unittestFixedArray();
Unittest for FixedArray.