Segfault with std.container.Array but not regular dynamic array

Dan dbdavidson at yahoo.com
Mon Nov 26 13:16:30 PST 2012


On Monday, 26 November 2012 at 19:14:09 UTC, Joseph Rushton 
Wakeling wrote:
> On 11/26/2012 04:07 PM, Joseph Rushton Wakeling wrote:
>> I'm a bit confused as to why.  By the look of things it's 
>> actually the creation
>> of new entries in the Node[uint] associative array, rather 
>> than appending links
>> to the individual nodes.  Can anyone advise?
>
> I have noticed that changing Node1 and Node2 from structs to 
> classes means the code no longer segfaults, so presumably it's 
> something related to reference versus value types ... ?

I think it is probably more to do with the interplay of Array as 
a value type in a hash, as this produces the same crash.

--------------------------------------
import std.container;
unittest {
   alias Array!int IntArr;
   IntArr[int] map;
   map[1] = IntArr();
}


More information about the Digitalmars-d-learn mailing list