module utility; auto concat(T : E[n], E, size_t n)(in E[][] args...) @nogc { size_t offset = 0; T result = void; foreach(arr; args) { result[offset .. offset+arr.length] = arr; offset += arr.length; } assert(offset == result.length); return result; } @safe unittest { assert(concat!(int[0])() == []); assert(concat!(int[0])([]) == []); assert(concat!(int[0])([], []) == []); assert(concat!(int[1])([1]) == [1]); assert(concat!(int[1])([1], []) == [1]); assert(concat!(int[1])([], [1]) == [1]); assert(concat!(int[2])([1, 2]) == [1, 2]); assert(concat!(int[2])([1], [2]) == [1, 2]); assert(concat!(int[6])([1], [2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]); assert(concat!(char[12])("Hello", " ", "World!") == "Hello World!"); }