concat

Concatenates a list of arrays into a destination array. The function results in at most a single memory allocation, if the destination array is too small to contain the concatenation results.

The destination array is passed as a reference, so its length can be modified in-place as required. This avoids any per-element memory allocation, which the normal ~ operator suffers from.

Template params: T = type of array element

  1. DE[] concat(Buffer!(DE) dest, T arrays)
    DE[]
    concat
    (
    DE
    T...
    )
    (
    ref Buffer!(DE) dest
    ,)
  2. DE[] concat(DE[] dest, T arrays)

Parameters

dest Buffer!(DE)

reference to the destination array

arrays T

variadic list of arrays to concatenate

Return Value

Type: DE[]

dest

Examples

Buffer!(char) dest;
concat(dest, "hello "[], "world"[]);
test!("==")(dest[], "hello world");

Meta