tanya.range.array

$(D_PSYMBOL tanya.range.array) implements range primitives for built-in arrays.

This module is a submodule of tanya.range.

After importing of tanya/range/array.d built-in arrays can act as bidirectional ranges. For that to work the module defines a set of functions that accept a built-in array of any type as their first argument, so thanks to UFCS (Uniform Function Call Syntax) they can be called as if they were array member functions. For example the arrays the .length-property, but no .empty property. So here can be find the $(D_PSYMBOL empty) function. Since empty(array) and array.empty are equal for the arrays, arrays get a faked property empty.

The functions in this module don't change array elements or its underlying storage, but some functions alter the slice. Each array maintains a pointer to its data and the length and there can be several pointers which point to the same data. Array pointer can be advanced and the length can be reduced without changing the underlying storage. So slices offer the possibility to have multiple views into the same array, point to different positions inside it.

Strings (char[], (D_INLINECODE wchar[]) and (D_INLINECODE dchar[])) are treated as any other normal array, they aren't auto-decoded.

Members

Functions

popBack
void popBack(inout(T)[] array)

$(D_PSYMBOL popFront) and $(D_PSYMBOL popBack) advance the array and remove one element from its back, respectively.

popFront
void popFront(inout(T)[] array)

$(D_PSYMBOL popFront) and $(D_PSYMBOL popBack) advance the array and remove one element from its back, respectively.

Properties

back
inout(T) back [@property getter]

Returns the last element of the array.

empty
bool empty [@property getter]

Tests whether array is empty.

front
inout(T) front [@property getter]

Returns the first element of the array.

save
inout(T)[] save [@property getter]

Returns a copy of the slice array.

Meta