Allocating a class within another class during object init w/o passing in an allocator
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 15 13:08:51 PST 2016
On 12/15/2016 09:51 PM, David Zhang wrote:
> However, it leaves me with another question, how
> much (if any) space would the static array require from the class?
Depends on SomeClass. The array's size is just the value of
__traits(classInstanceSize, SomeClass). There's no overhead.
You can print such stuff at compile time with pragma(msg, ...):
----
pragma(msg, __traits(classInstanceSize, SomeClass));
pragma(msg, Foo.scStorage.sizeof); /* same */
----
More information about the Digitalmars-d-learn
mailing list