0

I have some driver code which looks like this:

static const uint8_t PREAMBLE = 0xA0;

enum class Channel: const uint8_t {
    0 = 0x0,
    1 = 0x8
};

void foo(Channel chan) {
    bar(PREAMBLE | channel);
}

Where the intention is for users to be able to pass in a channel by an ID to foo rather than the particular mask and then my code handles forming the correct address. The problem is the compiler complains that he does not know how to XOR Channel and const uint8_t, even though the underlying types are the same. Is there some extra hint (without explicit casting) I can provide to make this work?

Pete Becker
  • 74,985
  • 8
  • 76
  • 165
Madden
  • 1,024
  • 1
  • 9
  • 27

0 Answers0