Class Allocators
evilrat
evilrat666 at gmail.com
Mon Feb 1 05:51:47 UTC 2021
On Sunday, 31 January 2021 at 23:19:09 UTC, Kyle wrote:
> My best guess right now is that both class allocators and the
> placement new syntax are deprecated, but if that's the case I
> would expect a deprecation message when I try to use that
> new(address) Type syntax whether there's a class allocator
> present or not. Any insight into this? Thanks.
Yes, just use emplace() insead of placement new.
GC-less allocations however is up to you, either malloc/free,
std.experimental.allocator or any other way. You can make your
own smart pointer struct to handle this automatically, or better
use community packages such as 'automem'.
As for the message it is possible that this part of the reference
compiler was already passed deprecation period and should be
removed but was completely forgotten.
https://dlang.org/phobos/core_lifetime.html#.emplace
More information about the Digitalmars-d-learn
mailing list