copy structs without memcpy