I have a
typedef std::array<std::byte, 4> CatType;
And I want to initialize a constant of this type. I can do
const CatType mycat = {std::byte{0x00}, std::byte{0x00}, std::byte{0x00}, std::byte{0x00}};
Which works, but I'd like for readability something like
const CatType mycat = 0x001020ff
Which fails with error
conversion from ‘int’ to non-scalar type ‘const CatType’ {aka ‘const std::array<std::byte, 4>’} requested
Aucun commentaire:
Enregistrer un commentaire