Get class size of object
Maxim Fomin
maxim at maxim-fomin.ru
Sun Aug 11 09:40:47 PDT 2013
On Sunday, 11 August 2013 at 16:36:53 UTC, Adam D. Ruppe wrote:
> On Sunday, 11 August 2013 at 04:25:21 UTC, JS wrote:
>> Given an object, is there a built in way to get the size of
>> the class the object represents?
>
> try this:
>
> Object obj = new Whatever();
> auto size = typeid(obj).init.length;
Yes, this is answer to the question. By the way, it can be simply
enum S = typeid(Whatever).init.length;
More information about the Digitalmars-d-learn
mailing list