digitalmars.D.learn - Placement New
- JRM (7/7) Jul 04 2010 Does placement new work yet, or am I using it wrong?
- bearophile (6/7) Jul 04 2010 Take a look here:
- JRM (6/15) Jul 04 2010 I didn't see anything on that page referring to placement new. I also
- bearophile (4/5) Jul 04 2010 I think the new() and delete() standard methods are (were) the D way to ...
Does placement new work yet, or am I using it wrong? import std.c.stdlib; class Foo {} void main() { Foo f = new(malloc(Foo.sizeof)) Foo(); } With dmd 2.047: Error: no allocator for Foo
Jul 04 2010
JRM:Does placement new work yet, or am I using it wrong?Take a look here: http://www.digitalmars.com/d/2.0/memory.html But I think that part of D2 will change because Andrei doesn't like it, it will removed and it will be replaced by something I don't understand yet. Bye, bearophile
Jul 04 2010
Take a look here: http://www.digitalmars.com/d/2.0/memory.html But I think that part of D2 will change because Andrei doesn't like it, it will removed and it will be replaced by something I don't understand yet. Bye, bearophileI didn't see anything on that page referring to placement new. I also thought I remembered seeing something about class allocators going away too. TDPL doesn't mention allocators and only briefly mentioned placement new, so I wasn't sure if I was just using it incorrectly or if it is one of those planned but not fully implemented features. It seems to be looking like the latter.
Jul 04 2010
JRM:I didn't see anything on that page referring to placement new.I think the new() and delete() standard methods are (were) the D way to allocate the memory of a class instance where you want. Bye, bearophile
Jul 04 2010