Get class size of object

JS js.mdnq at gmail.com
Sun Aug 11 08:30:19 PDT 2013


On Sunday, 11 August 2013 at 09:30:32 UTC, Tobias Pankrath wrote:
> On 11.08.2013 06:25, JS wrote:
>> Given an object, is there a built in way to get the size of 
>> the class
>> the object represents? The object may be instantiated with a 
>> derived
>> instance of the object type, so using classInstanceSize 
>> doesn't work on
>> the type of the object.
>>
>> I can obviously go through the trouble of adding a class 
>> member and
>> override it in all the derived classes. I saw tsize in object 
>> but 2.063
>> says it doesn't exist.
>>
>
> There is no general way to do this at compile time in any 
> language.

Is this a mathematical fact that you have proven for all 
languages? I'd like to see your proof if it's not bigger than 
what will fit in a post.


More information about the Digitalmars-d-learn mailing list