将运算符赋值给变量作为函数

时间:2016-09-11 14:53:29

标签: swift

如何将<运算符分配给变量?我在扩展中需要这个:

extension: CollectionType where Generator.Element: Comparable {
    func someFunc {
        let op: (lhs: Self, rhs: Self) -> Bool
        if <some_condition> {
            op = Self.Generator.Element.< // - this is not work
        } else {
            op = Self.Generator.Element.> // - this is not work
        }
    }
}

0 个答案:

没有答案
相关问题