Class Allocators

Mike Parker aldacron at gmail.com
Mon Feb 1 05:50:00 UTC 2021


On Sunday, 31 January 2021 at 23:19:09 UTC, Kyle wrote:

> strategy outside of the class". 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.

Class allocators were deprecated in 2.080 and became an error in 
2.087:

https://dlang.org/deprecate.html

I assume the placement new syntax was supposed to have been 
deprecated as well. It's possible it was overlooked, or that it 
wasn't deprecated because it has an obscure use-case that I'm 
unaware of. These days we should be using std.conv.emplace:

https://dlang.org/phobos/std_conv.html#.emplace.4

See also:

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

I suggest you file an issue at:

https://issues.dlang.org/


More information about the Digitalmars-d-learn mailing list