https://issues.dlang.org/show_bug.cgi?id=16824
--- Comment #4 from Andrei Alexandrescu <[email protected]> --- (In reply to Andrei Alexandrescu from comment #3) > The owns() method allows allocators to figure that out, but returns true for > internal pointers as well, which means the following would not end well: > > auto ints2d = allocator.makeArray!(int[])(2); > auto bulk = allocator.makeArray!(int[])(ints2d.length * 100); > foreach(i; 0 .. ints2d.length) > ints2s[i] = bulk[i * 100 .. (i + 1) * 100]; > > which is a customary way to save on allocations in multidimensional arrays. > > @Atila, any good argument on how we can make this work? If not, I think we > should close as invalid. Corrected code: auto ints2d = allocator.makeArray!(int[])(2); auto bulk = allocator.makeArray!int(ints2d.length * 100); foreach(i; 0 .. ints2d.length) ints2s[i] = bulk[i * 100 .. (i + 1) * 100]; --
