On 11/12/11 9:37 AM, Martin Nowak wrote:
On Sat, 12 Nov 2011 16:17:29 +0100, Adam D. Ruppe <[email protected]> wrote:The way I'd do it is: S s; auto heap = new S; *heap = s; that should work.auto ps = std.conv.emplace(new S, s); Avoids the hacky array aliasing.
That constructs S two times.
// slightly more efficient auto ps2 = emplace(cast(S*)(new ubyte[](S.sizeof)).ptr, s); You will need to define a copy constructor for immutable fields.
That should work but it's rather complicated. Andrei
