Avoid using memcpy to copy a single struct