1 | #pragma once |
---|---|
2 | |
3 | /// Multiple Boolean values. That is, two Boolean values: can it be true, can it be false. |
4 | struct BoolMask |
5 | { |
6 | bool can_be_true = false; |
7 | bool can_be_false = false; |
8 | |
9 | BoolMask() {} |
10 | BoolMask(bool can_be_true_, bool can_be_false_) : can_be_true(can_be_true_), can_be_false(can_be_false_) {} |
11 | |
12 | BoolMask operator &(const BoolMask & m) |
13 | { |
14 | return BoolMask(can_be_true && m.can_be_true, can_be_false || m.can_be_false); |
15 | } |
16 | BoolMask operator |(const BoolMask & m) |
17 | { |
18 | return BoolMask(can_be_true || m.can_be_true, can_be_false && m.can_be_false); |
19 | } |
20 | BoolMask operator !() |
21 | { |
22 | return BoolMask(can_be_false, can_be_true); |
23 | } |
24 | }; |
25 |