Array

struct Array (
T
) {}

Constructors

this
this(A allocator)

Constructs a qualified array that will use the provided allocator object. For immutable objects, a RCISharedAllocator must be supplied.

this
this(U[] values)

Constructs a qualified array out of a number of items. Because no allocator was provided, the array will use the GCAllocator.std.experimental.allocator.gc_allocator..

this
this(A allocator, U[] values)

Constructs a qualified array out of a number of items that will use the provided allocator object. For immutable objects, a RCISharedAllocator must be supplied.

this
this(Stuff stuff)

Constructs a qualified array out of an input range. Because no allocator was provided, the array will use the GCAllocator.std.experimental.allocator.gc_allocator.. If Stuff defines length, Array will use it to reserve the necessary amount of memory.

this
this(A allocator, Stuff stuff)

Constructs a qualified array out of an input range that will use the provided allocator object. For immutable objects, a RCISharedAllocator must be supplied. If Stuff defines length, Array will use it to reserve the necessary amount of memory.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

opDollar
alias opDollar = length

Return the number of elements in the array..

Functions

capacity
size_t capacity()

Get the available capacity of the array; this is equal to length of the array plus the available pre-allocated, free, space.

dup
Array!T dup()

Perform a copy of the array. This will create a new array that will copy the elements of the current array. This will NOT call dup on the elements of the array, regardless if T defines it or not.

empty
bool empty()

Check if the array is empty.

forceLength
void forceLength(size_t len)

Set the length of the array to len. len must be less than or equal to the capacity of the array.

front
auto ref front()

Provide access to the first element in the array. The user must check that the array isn't empty, prior to calling this function.

idup
Array!T idup()
Undocumented in source.
insert
size_t insert(size_t pos, Stuff stuff)
size_t insert(size_t pos, Stuff[] stuff)

Inserts the elements of an input range, or a variable number of items, at the given pos.

isUnique
bool isUnique()

Check whether there are no more references to this array instance.

length
size_t length()

Return the number of elements in the array..

opAssign
auto ref opAssign(typeof(this) rhs)

Assign rhs to this array. The current array will now become another reference to rhs, unless rhs is null, in which case the current array will become empty. If rhs refers to the current array nothing will happen.

opBinary
auto ref opBinary(U rhs)

Create a new array that results from the concatenation of this array with rhs.

opCmp
int opCmp(U rhs)
opEquals
bool opEquals(typeof(this) rhs)
opIndex
auto ref opIndex(size_t idx)

Provide access to the element at idx in the array. idx must be less than length.

opIndexAssign
auto ref opIndexAssign(U elem, size_t idx)

Assign elem to the element at idx in the array. idx must be less than length.

opIndexAssign
auto ref opIndexAssign(U elem)

Assign elem to all element in the array.

opIndexOpAssign
auto ref opIndexOpAssign(U elem, size_t idx)

Assign to the element at idx in the array the result of a[idx] op elem. idx must be less than length.

opIndexUnary
auto ref opIndexUnary(size_t idx)

Apply an unary operation to the element at idx in the array. idx must be less than length.

opOpAssign
auto ref opOpAssign(U rhs)

Append the elements of rhs at the end of the array.

opSlice
Qualified opSlice()

Return a slice to the current array. This is equivalent to calling save.

opSlice
Qualified opSlice(size_t start, size_t end)

Return a slice to the current array that is bounded by start and end. start must be less than or equal to end and end must be less than or equal to length.

opSliceAssign
auto opSliceAssign(U elem, size_t start, size_t end)

Assign elem to the element at idx in the array. idx must be less than length.

popFront
void popFront()

Advance to the next element in the array. The user must check that the array isn't empty, prior to calling this function.

reserve
void reserve(size_t n)

Reserve enough memory from the allocator to store n elements. If the current capacity exceeds n nothing will happen. If n exceeds the current capacity, an attempt to expand the current array is made. If expand is successful, all the expanded elements are default initialized to T.init. If the expand fails a new buffer will be allocated, the old elements of the array will be copied and the new elements will be default initialized to T.init.

save
auto ref save()

Perform a shallow copy of the array.

tail
Qualified tail()

Advance to the next element in the array. The user must check that the array isn't empty, prior to calling this function.

toHash
auto toHash()

Templates

each
template each(alias fun)

Eagerly iterate over each element in the array and call fun over each element. This should be used to iterate through const and immutable arrays.

Variables

_payload
T[] _payload;
Undocumented in source.
_support
Unqual!T[] _support;
Undocumented in source.

Meta