var.element

var element(size_t index) const @safe

Boxes a single element of a native array into a var.

Reads primarily go through typed slices (as!(const(T)[])), which stay zero-copy; element is the on-demand convenience for one value. Native real elements box only when exactly representable as double — otherwise this throws, honoring the no-silent-narrowing contract.

Parameters

indexelement index; bounds-checked.

Returns

A var holding the element value.

Throws

VarTypeException for non-native values; VarIndexException when out

of bounds; VarException for unrepresentable real elements.