digitalmars.D.learn - get size of class instance (not reference)?
- Nick Sabalausky (5/5) Feb 25 2013 These just give me the size of a *reference* to the class:
- bearophile (5/6) Feb 25 2013 Is this enough?
- Nick Sabalausky (4/12) Feb 25 2013 Ahh, yes, of course. I had a feeling I was overlooking something
- Steven Schveighoffer (7/19) Feb 26 2013 ClassInfo also has an init property which is a block of memory that is t...
These just give me the size of a *reference* to the class: class Foo {...} Foo.sizeof typeid(Foo).tsize How can I get the size of a non-subclassed *instance*?
Feb 25 2013
Nick Sabalausky:How can I get the size of a non-subclassed *instance*?Is this enough? http://dlang.org/traits.html#classInstanceSize Bye, bearophile
Feb 25 2013
On Tue, 26 Feb 2013 01:54:44 +0100 "bearophile" <bearophileHUGS lycos.com> wrote:Nick Sabalausky:Ahh, yes, of course. I had a feeling I was overlooking something obvious. Thanks.How can I get the size of a non-subclassed *instance*?Is this enough? http://dlang.org/traits.html#classInstanceSize
Feb 25 2013
On Mon, 25 Feb 2013 20:09:05 -0500, Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:On Tue, 26 Feb 2013 01:54:44 +0100 "bearophile" <bearophileHUGS lycos.com> wrote:ClassInfo also has an init property which is a block of memory that is the default data in the class. This is what druntime uses when allocating a class. This would work to get the derived type length as well. -SteveNick Sabalausky:Ahh, yes, of course. I had a feeling I was overlooking something obvious. Thanks.How can I get the size of a non-subclassed *instance*?Is this enough? http://dlang.org/traits.html#classInstanceSize
Feb 26 2013