[Issue 11415] Assign range to array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 2 04:36:22 PDT 2013


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



--- Comment #7 from monarchdodra at gmail.com 2013-11-02 04:36:18 PDT ---
(In reply to comment #6)
> @monarchdodra, that's true, however even this usage of copy is wrong as d
> should change length.
> 
> Printing d after the copy produces: [4, 5, 6, 7, 5, 6, 7]
> where it is meant to be [4, 5, 6, 7]
> 
> So you'll either have to go with what daniel350 had in his first post, or with
> the allocating array call.

Huh. I didn't even notice OP had gotten it right in his original post. Serves
me for not fully reading.

I guess it really boils down to if you want a new array, or if you want to
overwrite existing data. For example, copy can be used to write inside a slice
taken from a stack allocated static array.

-- 
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