考虑以下代码:
protocol __Strideable {
associatedtype Stride
}
struct __ClosedRangeIndex<Bound: __Strideable> where Bound.Stride: SignedInteger {
}
protocol __ClosedRangeType {
associatedtype Bound: __Strideable
// Error: Type 'Self._Bound.Stride' does not conform to protocol 'SignedInteger'
var startIndex: __ClosedRangeIndex<Bound> { get }
}
是否可以向associatedtype
添加约束?
像:
associatedtype _Bound: __Strideable where _Bound.String: SignedInteger
? (那个人显然没有工作)