On Saturday, 25 February 2017 at 15:21:56 UTC, Radu wrote:

The correct way of doing it using deref would to look like:

struct A { int i; }

auto a = cast (A*) malloc(A.sizeof); // Allocate
emplace(a, 42);                      // Construct
destroy(*a);                          // Destruct A
free(a);                             // Deallocate
destroy(a);                          // Destruct A*
assert(a is null);

Right, I read the post and immediately failed to apply the new knowledge. Bad me, thanks for the correction.

Reply via email to