Get class size of object

Tobias Pankrath lists at pankrath.net
Sun Aug 11 02:18:31 PDT 2013


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.


More information about the Digitalmars-d-learn mailing list