append

Return data appended with arguments args.

If data is an r-value it's modified and returned, otherwise a copy is made and returned.

C
append
(
C
Args...
)
(
auto ref C data
,
auto ref Args args
)
if (
args.length >= 1
)

Examples

append

alias Str = UniqueString!false;

assert(Str(`a`).append('b', 'c')[] == `abc`);
assert(Str(`a`).append(`b`, `c`)[] == `abc`);

const Str x = Str(`a`).append('b', 'c'); // is moved
assert(x[] == `abc`);

Str y = `x`;
Str z = y.append('y', 'z', `w`); // needs dup
assert(y.ptr != z.ptr);
assert(z[] == `xyzw`);

Meta