uint data1;
ushort data2;
ushort data3;
uchar data4[8];
std::uint8_t buff[16];
std::uint8_t* out = buff;
out = std::copy_n(reinterpret_cast<std::uint8_t*>(&quid.data1), 4, out);
out = std::copy_n(reinterpret_cast<std::uint8_t*>(&quid.data2), 2, out);
out = std::copy_n(reinterpret_cast<std::uint8_t*>(&quid.data3), 2, out);
std::copy_n(quid.data4, 8, out);
out
如果我不使用,为什么结果会有所不同reinterpret_cast
?