avoid memcpy of non-trivially copyable types