第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Xcode 7.3已棄用“ ++”和“-”運(yùn)算符

Xcode 7.3已棄用“ ++”和“-”運(yùn)算符

子衿沉夜 2019-11-28 09:43:15
我正在查看Xcode 7.3注釋,并且注意到了這個(gè)問(wèn)題。++和-運(yùn)算符已被棄用有人可以解釋為什么不推薦使用它嗎?我說(shuō)對(duì)了,現(xiàn)在在新版本的Xcode中,您將使用它代替++它x += 1;例:for var index = 0; index < 3; index += 1 {    print("index is \(index)")}
查看完整描述

3 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊

我意識(shí)到,盡管如此,此評(píng)論仍未解決問(wèn)題,可能有人會(huì)在尋找一種解決方案,以使這些操作員保持工作狀態(tài),這種解決方案可以在底部找到。?


我個(gè)人更喜歡++和--運(yùn)營(yíng)商。我不同意它們棘手或難以管理的觀點(diǎn)。一旦開(kāi)發(fā)人員了解了這些運(yùn)算符的功能(并且我們正在談?wù)摲浅:?jiǎn)單的內(nèi)容),則代碼應(yīng)該非常清楚。


在解釋為什么不推薦使用運(yùn)算符時(shí),提到了它們的主要用途是C風(fēng)格的for循環(huán)。我對(duì)其他人一無(wú)所知,但我個(gè)人根本不使用C風(fēng)格的循環(huán),在還有其他地方或情況下,++或--運(yùn)算符是有用的。


我還要提及的是,它varName++返回一個(gè)值,因此可以在returnwhile中使用它,而varName += 1不能在其中使用。


對(duì)于任何想讓這些操作員在這里工作的人,解決方案是:


prefix operator ++ {}

postfix operator ++ {}


prefix operator -- {}

postfix operator -- {}



// Increment

prefix func ++(inout x: Int) -> Int {

    x += 1

    return x

}


postfix func ++(inout x: Int) -> Int {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: UInt) -> UInt {

    x += 1

    return x

}


postfix func ++(inout x: UInt) -> UInt {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Int8) -> Int8 {

    x += 1

    return x

}


postfix func ++(inout x: Int8) -> Int8 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: UInt8) -> UInt8 {

    x += 1

    return x

}


postfix func ++(inout x: UInt8) -> UInt8 {

    x += 1

    return (x - 1)

}

prefix func ++(inout x: Int16) -> Int16 {

    x += 1

    return x

}


postfix func ++(inout x: Int16) -> Int16 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: UInt16) -> UInt16 {

    x += 1

    return x

}


postfix func ++(inout x: UInt16) -> UInt16 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Int32) -> Int32 {

    x += 1

    return x

}


postfix func ++(inout x: Int32) -> Int32 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: UInt32) -> UInt32 {

    x += 1

    return x

}


postfix func ++(inout x: UInt32) -> UInt32 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Int64) -> Int64 {

    x += 1

    return x

}


postfix func ++(inout x: Int64) -> Int64 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: UInt64) -> UInt64 {

    x += 1

    return x

}


postfix func ++(inout x: UInt64) -> UInt64 {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Double) -> Double {

    x += 1

    return x

}


postfix func ++(inout x: Double) -> Double {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Float) -> Float {

    x += 1

    return x

}


postfix func ++(inout x: Float) -> Float {

    x += 1

    return (x - 1)

}


prefix func ++(inout x: Float80) -> Float80 {

    x += 1

    return x

}


postfix func ++(inout x: Float80) -> Float80 {

    x += 1

    return (x - 1)

}


prefix func ++<T : _Incrementable>(inout i: T) -> T {

    i = i.successor()

    return i

}


postfix func ++<T : _Incrementable>(inout i: T) -> T {

    let y = i

    i = i.successor()

    return y

}


// Decrement

prefix func --(inout x: Int) -> Int {

    x -= 1

    return x

}


postfix func --(inout x: Int) -> Int {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: UInt) -> UInt {

    x -= 1

    return x

}


postfix func --(inout x: UInt) -> UInt {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Int8) -> Int8 {

    x -= 1

    return x

}


postfix func --(inout x: Int8) -> Int8 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: UInt8) -> UInt8 {

    x -= 1

    return x

}


postfix func --(inout x: UInt8) -> UInt8 {

    x -= 1

    return (x + 1)

}

prefix func --(inout x: Int16) -> Int16 {

    x -= 1

    return x

}


postfix func --(inout x: Int16) -> Int16 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: UInt16) -> UInt16 {

    x -= 1

    return x

}


postfix func --(inout x: UInt16) -> UInt16 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Int32) -> Int32 {

    x -= 1

    return x

}


postfix func --(inout x: Int32) -> Int32 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: UInt32) -> UInt32 {

    x -= 1

    return x

}


postfix func --(inout x: UInt32) -> UInt32 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Int64) -> Int64 {

    x -= 1

    return x

}


postfix func --(inout x: Int64) -> Int64 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: UInt64) -> UInt64 {

    x -= 1

    return x

}


postfix func --(inout x: UInt64) -> UInt64 {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Double) -> Double {

    x -= 1

    return x

}


postfix func --(inout x: Double) -> Double {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Float) -> Float {

    x -= 1

    return x

}


postfix func --(inout x: Float) -> Float {

    x -= 1

    return (x + 1)

}


prefix func --(inout x: Float80) -> Float80 {

    x -= 1

    return x

}


postfix func --(inout x: Float80) -> Float80 {

    x -= 1

    return (x + 1)

}


prefix func --<T : BidirectionalIndexType>(inout i: T) -> T {

    i = i.predecessor()

    return i

}


postfix func --<T : BidirectionalIndexType>(inout i: T) -> T {

    let y = i

    i = i.predecessor()

    return y

}


查看完整回答
反對(duì) 回復(fù) 2019-11-28
  • 3 回答
  • 0 關(guān)注
  • 713 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)