Nested Structs (Solution)

js.mdnq js_adddot+mdng at gmail.com
Thu Dec 13 23:39:32 PST 2012


http://dpaste.dzfl.pl/64025e0a

contains updated code. When the offset of the struct is 0 it 
contains an actual ptr to the class(the standard way) and hence 
can be "orphaned". When the offset is not 0 then it is part of a 
class object and can use a calculation to get the parent.

Both methods work somewhat easily together as demonstrated by the 
last example.

Unfortunately it seems we have to make an assignment.

A.B!(0) b = a.b1;

does not work but

A.B!(0) b;
b = a.b1;

does. Not sure if there is some way to make the first work.



More information about the Digitalmars-d mailing list