Avatar
@swift-main @swift-5.1.5 @swift-5.0.3 import Foundation public protocol NMBComparable { func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult } extension NSNumber: NMBComparable { public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { return compare(otherObject as! NSNumber) } } func take<T: Comparable>(_ a: T, _ b: T) {} func take<T: NMBComparable>(_ a: T, _ b: T) {} take(1, 2) take(NSNumber(value: 1), NSNumber(value: 2)) take(1, NSNumber(value: 2)) take(NSNumber(value: 1), 2) (edited)