Pointer problems, changing for no reasons

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 10 01:56:41 PDT 2016


On Friday, 10 June 2016 at 08:32:40 UTC, Begah wrote:
> In the constructor, i copied the textures to the model's inner 
> texture array, and for some reason this caused the problem.
> So i needed to change to something like :
>
> this.textures.length = textures.length;
> foreach(i; 0..textures.length) {
> 	this.textures[i] = textures[i];
> }

the easier one-line solution:

this.textures = textures.dup;


More information about the Digitalmars-d-learn mailing list