Is this really the best way to declare a byte (or array of bytes)?
static constexpr byte kGuard1_[] = {
byte{0x45}, byte{0x23}, byte{0x12}, byte{0x56}, byte{0x99}, byte{0x76}, byte{0x12}, byte{0x55},
};
why isn't there some suffix (like b) that you can use to directly mark the number as a byte? Or is the problem just with my use of uniform initialization?
I can't say if this is better but it's different since you won't have to repeat
bytefor every element:Note that it uses a
std::array<std::byte, 8>instead of astd::byte[8].I can't say, but if you want you can define your own user-defined literal that could be used with C arrays.
No, it's just that there is no implicit conversion to
std::byte.