I have the following enum
:
enum enumLoanPaymentPolicy
{
Unspecified = 0,
InterestInArrears = 1 << 1,
InterestInAdvance = 1 << 2,
RoundUpRepayments = 1 << 3,
RoundInterest = 1 << 4,
RoundUpFlows = 1 << 5,
RoundingMask = RoundUpRepayments | RoundInterest | RoundUpFlows,
};
Then elsewhere, given a value (foo
) of this enumeration, I want to extract the bits set that are pertinent to Round
.
I use foo & RoundingMask
for that, but what type should I use?
Ideally I'd use somethingorother(enumLoanPaymentPolicy) bar = foo & RoundingMask
where somethingorother
is a bit like decltype
. Is this even possible?