On Saturday, 25 April 2015 at 19:21:28 UTC, weaselcat wrote:
On Saturday, 25 April 2015 at 19:16:21 UTC, Namespace wrote:
hmm...
http://dlang.org/phobos/std_conv.html#.emplace

constructs an object of non-class type T at that address.

Non-Class. ;)

There's a class overload 3 down
T emplace(T, Args...)(void[] chunk, auto ref Args args) if (is(T == class));

Which accepts a void[] chunk:
----
Foo f = new Foo(...);
emplace!(Foo)((cast(void*) f)[0 .. __traits(classInstanceSize, Foo)], ...);
----
That doesn't look like a "simple and friendly" manner for me. And it is also still not intuitive, not nice and not safe.

Reply via email to