bitwise operator with enum?
Posted: Sun Dec 07, 2008 10:49 pm
I'm getting error trying to use bitwise operator on combined enum values:
is there any support for bitwise operators on enum without casting every operand to int?
enum Borders
Top = 1
Right = 2
Bottom = 4
Left = 8
class Test
def main is shared
borders = Borders(Top,Left)
assert (borders & Borders.Top) == Borders.Top
- Code: Select all
test.cobra(10): error: Cannot apply AMPERSAND to Borders. Try finding a method that performs this function.
Compilation failed - 1 error, 0 warnings
is there any support for bitwise operators on enum without casting every operand to int?