Allocating a class within another class during object init w/o passing in an allocator

David Zhang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 16 10:25:42 PST 2016


> I haven't considered alignment here. I'm not sure if you have 
> to.

I though all classes were aligned to sizeof(size_t) boundaries? 
Wouldn't it then just be

align(sizeof(size_t)) byte[__traits(classInstanceSize, 
SomeClass)] scStorage;


More information about the Digitalmars-d-learn mailing list