Skip to content

CxxUtils: implement multi-type support for ATH_BITMASK

Frank Winklmeier requested to merge fwinkl/athena:cxxutils_bitmask into main

Allow bitwise operations between different ATH_BITMASK enum types (as long as the underlying type is the same). This allows one to write code as the following without explicit type conversions:

   enum class Mask {
     Bit1 = 1,
     ATH_BITMASK
   };
   enum class OtherMask {
     Bit2 = 2,
     ATH_BITMASK
   };

   int result = Mask::Bit1 & OtherMask::Bit2;

This only works for the non-assignment version of the operators.

In addition:

  • modernize code using C++17 syntax
  • make all operators constexpr

P.S.: This will e.g. allow to elegantly fix the gcc13 compiler warnings in xAODMissingET by using scoped enums.

Merge request reports