Skip to content

Commit 792dce7

Browse files
author
mkandil
committed
remove filter function from protocol and add it to the extenstion
1 parent 2dccec9 commit 792dce7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

stdlib/public/Cxx/CxxDictionary.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,20 @@ public protocol CxxDictionary<Key, Value> {
2525

2626
/// Do not implement this function manually in Swift.
2727
func __endUnsafe() -> RawIterator
28+
}
2829

30+
extension CxxDictionary {
31+
@inlinable
32+
public subscript(key: Key) -> Value? {
33+
get {
34+
let iter = __findUnsafe(key)
35+
guard iter != __endUnsafe() else {
36+
return nil
37+
}
38+
return iter.pointee.second
39+
}
40+
}
41+
2942
func filter(
3043
_ isIncluded: (Key, Value) throws -> Bool
3144
) rethrows -> [Key: Value] {
@@ -42,16 +55,3 @@ public protocol CxxDictionary<Key, Value> {
4255
}
4356
}
4457
}
45-
46-
extension CxxDictionary {
47-
@inlinable
48-
public subscript(key: Key) -> Value? {
49-
get {
50-
let iter = __findUnsafe(key)
51-
guard iter != __endUnsafe() else {
52-
return nil
53-
}
54-
return iter.pointee.second
55-
}
56-
}
57-
}

0 commit comments

Comments
 (0)