From a8cca4584ababe31d610d7767df71eb43090d968 Mon Sep 17 00:00:00 2001 From: Ilya Yaroshenko Date: Wed, 17 Apr 2019 16:03:14 +0700 Subject: [PATCH] moveEmplace: optimise and make it betterC friendly --- src/core/lifetime.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lifetime.d b/src/core/lifetime.d index 93b562cd73..5ccdd7c9be 100644 --- a/src/core/lifetime.d +++ b/src/core/lifetime.d @@ -1801,8 +1801,8 @@ void moveEmplace(T)(ref T source, ref T target) @system memset(&source, 0, sz); else { - auto init = typeid(T).initializer(); - memcpy(&source, init.ptr, sz); + const init = T.init; + memcpy(&source, &init, sz); } } }