Comment Comment by ntrel This compiles: ref ubyte[n*2] requires_ptr_twice_as_large_as_input(uint n) ( const ref ubyte[n] input, ref ubyte[n*2] output, ) { output[0..n] = input[0..n]; output[n..2*n] = input[0..n]; return output; } void main() { ubyte[10] input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; ubyte[20] output; requires_ptr_twice_as_large_as_input!(10)(input, output); import std.stdio; writeln(output); assert(output == input ~ input); } parent ntrel 3 years ago