【发布时间】:2017-04-21 02:07:12
【问题描述】:
假设存在一个通用结构:
public struct Matrix<T> where T: FloatingPoint, T: ExpressibleByFloatLiteral {
// some methods...
}
是否可以使用where 子句扩展结构以符合受约束T 的协议?例如。像
extension Matrix where T: SpecificClass : SomeProtocol {
// This does not compile :(
}
【问题讨论】:
标签: swift generics swift4 generic-programming swift-protocols