This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension KeyValuePairs { | |
init(elements: [(Key, Value)]) { | |
func initialize(elements: [(Key, Value)]) -> Self { | |
typealias Function = ([(Key, Value)]) -> Self | |
let castedInit = unsafeBitCast(Self.init(dictionaryLiteral:), to: Function.self) | |
return castedInit(elements) | |
} | |
self = initialize(elements: elements) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ComparisonPredicateValue { | |
var value: Bool? { get } | |
} | |
enum ComparisonPredicate<T: Comparable>: ComparisonPredicateValue { | |
typealias Predicate = ((T, T) -> Bool) | |
case predicate(lhs: T, rhs: T, Predicate) | |