idiomatic D: what to use instead of pointers in constructing a tree data structure?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 14 11:05:16 PST 2015


On Tuesday, 13 January 2015 at 17:41:53 UTC, Tobias Pankrath 
wrote:
> On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc 
> wrote:
>>
>> The GC is allowed to move structs around, as I undestand it.  
>> Under what circumstances do I get into trouble having a 
>> pointer to them?
>
> None, a GC that moves structs around must update every pointer 
> afterwards and as far as I know, the standard GC doesn't do 
> that (moving things around).
>
> You may not have a pointer inside a struct that points to the 
> struct itself. This allows the compiler to elide some copies.

Got it - thanks.


More information about the Digitalmars-d-learn mailing list