Problems with Array Assignment?

Stefan Koch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 10 06:41:48 PDT 2017


On Wednesday, 10 May 2017 at 13:34:30 UTC, Samwise wrote:
> I'm really sure this is just a stupid mistake I made, but I 
> can't for the life of me figure out what is going on. Basically 
> I'm trying to assign a reference to an object to an array, and 
> the objects exist (an explicit destructor is writing lines at 
> the end of the program, when the objects are GC'd), but there 
> are not references to them in the array. You can see the 
> complete code, and the line that I think is giving me trouble 
> here: 
> https://github.com/MggMuggins/TrafficLights/blob/master/source/renderer.d#L146
>
> Any help is greatly appreciated. Like I said, I'm sure it's 
> just a silly mistake because I don't understand something, but 
> I appreciate any time you waste on me all the same. Thanks,
> ~Sam

tiles can be zero if you do not initialize it explicitly.
assert(tiles, "tiles is zero");
should clue you in.


More information about the Digitalmars-d-learn mailing list