how to allocate class without gc?

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 25 21:11:54 PST 2016


On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote:
> Is there any examples that shows how to properly allocate an 
> object of a class type with the new allocators and then release 
> it when desired?

Allocate a block of memory big enough to hold an instance of your 
class using whichever allocator you need, then instantiate a 
class instance with std.conv.emplace.

http://p0nce.github.io/d-idioms/#Placement-new-with-emplace


More information about the Digitalmars-d-learn mailing list