Is there any way to describe in Swift an IntegerType
that has a max
property? (something similar to implicit interfaces in go)
There is no protocol to describe a max
attribute, and even if I create one, IntegerType
does not explicitly implement it.
So basically I'm looking for something like:
class Test<T: IntegerType where ?> { // <- ? = something like 'has a "max: Self"' property
}
let t = Test<UInt8>()
or maybe something like:
implicit protocol IntegerTypeWithMax: IntegerType {
static var max: Self { get }
}
class Test<T: IntegerTypeWithMax> {
}
let t = Test<UInt8>()