how to allocate class without gc?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 25 22:47:01 PST 2016


On 01/25/2016 09:47 PM, Igor wrote:

 > it fails because the string representing the name inside App is null...
 > Which doesn't happen when I use new.

There must be something else going on. Do you see it with a simpler type?

 > Should it work as expected(which it isn't)

new allocates and constructs, emplace does not allocate and construct. 
That shold be the only difference.

 > or do I have to also emplace all the fields and such so they are not for
 > some reason released?

Not at all.

Ali



More information about the Digitalmars-d-learn mailing list