Get class size of object

Adam D. Ruppe destructionator at gmail.com
Sun Aug 11 12:06:05 PDT 2013


On Sunday, 11 August 2013 at 18:33:19 UTC, JS wrote:
> The code below does this, but at a cost of verbosity.

I don't see what the difference is in functionality - it looks to 
me that you just reimplemented what the compiler does 
automatically with typeid.

The way typeid(obj) works is similar to a virtual function call 
internally, indeed, Class.vtbl[0] is a pointer to its TypeInfo 
instance.

But anyway, then the typeinfo contains functions for the class 
name and size, pretty similar to what you just did.


What does your implementation give you that typeid() doesn't?


More information about the Digitalmars-d-learn mailing list