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

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 13 09:41:52 PST 2015


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.


More information about the Digitalmars-d-learn mailing list