https://issues.dlang.org/show_bug.cgi?id=15662
--- Comment #9 from Dicebot <pub...@dicebot.lv> --- (In reply to Kenji Hara from comment #8) > void moveAppend(T)(ref T[] arr, T elem) > { > if (!arr.capacity) throw new Error("cannot append"); > > swap(*(arr.ptr + arr.length), elem); > arr = arr.ptr[0 .. arr.length + 1]; > > // *uninitialize* elem, as same as std.algorithm.move > memcpy(&elem, typeid(T).initializer().ptr, sz); > } Yes, this is close to what I had in mind (main difference is that I need re-allocation to be allowed too, invalidating previous block, but that is also trivially doable). The problem I see with such approach is usual type erasure druntime often suffers from. Requiring same qualifiers for array elements and appended one is overly limited but relaxing it means the functions needs to reimplement all the implicit conversion checks compiler already does. --