I work on a project with many bitwise option sets and each of them contains many options with all
option e.g:
struct MyOption: OptionSet {
let rawValue: Int
static let a = Self(rawValue: 1 << 0)
static let b = Self(rawValue: 1 << 1)
static let c = Self(rawValue: 1 << 2)
...
static let last = Self(rawValue: 1 << N)
static let all: Self = [.a, .b, .c, ..., .last]
}
It requires to maintain much of similar code so is it any way to eliminate hardcoded bitwise shift operations and the all
option?