假设存在一个通用结构:
public struct Matrix<T> where T: FloatingPoint, T: ExpressibleByFloatLiteral {
// some methods...
}
Run Code Online (Sandbox Code Playgroud)
是否可以扩展struct以符合约束T使用where子句的协议?比如像
extension Matrix where T: SpecificClass : SomeProtocol {
// This does not compile :(
}
Run Code Online (Sandbox Code Playgroud)