front

Returns the first element of the array.

The element is returned by reference, so $(D_PSYMBOL front) can be also used to change the first element of array if it is mutable.

@property ref
inout(T)
front
(
T
)
(
return scope inout(T)[] array
)

Parameters

T

Element type of array.

array inout(T)[]

Built-in array.

Return Value

Type: inout(T)

First element.

Precondition: array.length > 0.

Examples

string s = "Wenn die Wunde nicht mehr wehtut, schmerzt die Narbe";
static assert(is(typeof(s.front) == immutable char));
assert(s.front == 'W');

wstring w = "Волны несутся, гремя и сверкая";
static assert(is(typeof(w.front) == immutable wchar));
assert(w.front == 'В');

dstring d = "Для писателя память - это почти все";
static assert(is(typeof(d.front) == immutable dchar));
assert(d.front == 'Д');

Meta