[Issue 8910] Static arrays, dynamic arrays and std.array.join

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 30 14:20:12 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8910



--- Comment #16 from bearophile_hugs at eml.cc 2012-10-30 14:20:00 PDT ---
(In reply to comment #9)

> So, you think that copying a static array is a good idea? Because that's what
> on overload for a static array would do. And all that overload could do would
> be to slice the static array and pass it to the normal overload (because static
> arrays are _not_ ranges and _cannot_ be, because you can't pop any of their
> elements off), which would lead to the slice being completely invalid once the
> function returned, meaning that the result would be completely unsafe and
> invalid. So no, that wouldn't work.

This bug report is about a join() that works with fixed-size matrix. join() is
supposed to allocate a new array as large as the sum of the rows plus the
optional separators.
And if this join function is well written (taking fixed sized array by
reference and not using the dynamic-array function badly as you say), the
result is correct and the requested computation is done efficiently, it's more
efficient than the case with dynamic arrays, because there is less indirection
and being all the rows of the same length there is no need to read and use
every length of each row as in the dynamic array case, because it's surely
rectangular.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list