Check if a flags value contains, intersects, or is empty
mainWhen working with Flags values, you can perform several logical checks:
- Contains: Returns true if all set bits in the source flags value are also set in the target flags value.
- Intersects: Returns true if any set bits in the source flags value are also set in the target flags value.
- Empty: Returns true if all bits in the flags value are unset (
0b0000_0000). - All: Returns true if all defined flags in the flags type are contained within the flags value.
Example logic for a value 0b0000_0011:
- It contains:
0b0000_0000,0b0000_0010,0b0000_0001,0b0000_0011. - It intersects:
0b0000_0010,0b0000_0001,0b1111_1111. - It does not intersect:
0b0000_0000,0b1111_0000.