Hi All,
Does anyone have a good workaround for generics not currently supporting
conditional conformance to a protocol. As stated in the Generics Manifesto
something like this would be nice:
extension Array: Equatable where Element: Equatable {
static func ==(lhs: Array, rhs: Array) -> Bool { ... }
}
But I would currently write a wrapper, something like:
struct ArrayE<T: Equatable> {
var elements: [T]
}
extension ArrayE: Equatable {
static func ==(lhs: ArrayE, rhs: ArrayE) -> Bool { ... }
}
This can get unwieldy when there are a lot of conditional protocol
extensions required, i.e. wrappers round wrappers.
Is there a better way?
Thanks for any tips,
-- Howard.
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users