only

fnauto only(Values...)(return scope Values values) if (!is(CommonType!Values == void))

Assemble values into a range that carries all its elements in-situ.

Useful when a single value or multiple disconnected values must be passed to an algorithm expecting a range, without having to perform dynamic memory allocation.

As copying the range means copying all elements, it can be safely returned from functions. For the same reason, copying the returned range may be expensive for a large number of arguments.

Parameters

valuesthe values to assemble together

Returns

A RandomAccessRange of the assembled values.

The returned range can be sliced. Its elements can be assigned to if every type in Values supports assignment from the range's element type.

See Also

chain to chain ranges
fnauto only()()

ditto