Swift equality operator on nested arrays

前端 未结 2 1006
太阳男子
太阳男子 2020-11-27 07:53

Why does the last statement fail to compile with the error: Binary operator \'==\' cannot be applied to two \'[[Simple]]’ operands, and is there a way way to mo

2条回答
  •  我在风中等你
    2020-11-27 08:25

    You can do it by implementing a == function for it, like following:

    func == (lhs: [[Simple]], rhs: [[Simple]]) -> Bool {
        //your code
    }
    

提交回复
热议问题