خرید بک لینک

Vote count: 0

I just was writine simple, understood for me, chunk of code, but it seems not working.

func sort<T : Comparable>(array: [T], ascending: Bool) -> [T] {
    if array.count <= 1 {
        retu array;
    }
    let left = sort(array[0..<array.count/2], ascending: ascending)
    let right = sort(array[array.count/2..<array.count], ascending: ascending)
    retu merge(left: left, right: right)
}

Xcode says that I can't use subscript on object of [T] but actually I don't understand why if [T] is an array and by default it should have a subscript.

asked 39 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 6 فروردين 1395 ساعت: 1:14

صفحه بندی