mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Constraining AnySequence.init
... to only allow sequences where SubSequence.SubSequence == SubSequence. See swift-evolution proposal https://github.com/apple/swift-evolution/blob/master/proposals/0014-constrained-AnySequence.md for more details.
This commit is contained in:
@@ -224,7 +224,14 @@ public struct AnySequence<Element> : SequenceType {
|
||||
public typealias T = Element
|
||||
|
||||
/// Wrap and forward operations to `base`.
|
||||
public init<S: SequenceType where S.Generator.Element == Element>(_ base: S) {
|
||||
public init<
|
||||
S: SequenceType
|
||||
where
|
||||
S.Generator.Element == Element,
|
||||
S.SubSequence : SequenceType,
|
||||
S.SubSequence.Generator.Element == Element,
|
||||
S.SubSequence.SubSequence == S.SubSequence
|
||||
>(_ base: S) {
|
||||
_box = _SequenceBox(base)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user