Justin Johansson wrote:
How does one determine the sizeof (in bytes) of an instance of a class in D?

.sizeof works as advertised for structs, but for reference types,
.sizeof yields the sizeof the referencing variable (effectively same as size of 
a pointer)
and not the size of the underlying instance.

I did try scanning the NG and read spec_D1.00.pdf.  Perhaps I missed it in the 
latter.

btw. I was poking under the hood of std.xml and though, wow, instances of 
Element
class look humongous, and so I'm interested to how exactly how humongous.

Thanks for all help.
Justin


The only way I know of is to access the init array of the classinfo at runtime and get its length property.

Reply via email to