diff --git a/src/modules/kutil/enum_bitfields.h b/src/modules/kutil/enum_bitfields.h index 443f68d..0778620 100644 --- a/src/modules/kutil/enum_bitfields.h +++ b/src/modules/kutil/enum_bitfields.h @@ -17,6 +17,15 @@ operator & (E lhs, E rhs) static_cast::type>(rhs)); } +template +typename std::enable_if::value,E>::type +operator | (E lhs, E rhs) +{ + return static_cast ( + static_cast::type>(lhs) | + static_cast::type>(rhs)); +} + template typename std::enable_if::value,E>::type operator ^ (E lhs, E rhs) @@ -72,3 +81,10 @@ operator ! (E rhs) { return static_cast::type>(rhs) == 0; } + +template +typename std::enable_if::value,bool>::type +bitfield_contains(E set, E flag) +{ + return (set & flag) == flag; +}