Avatar
extension Array { mutating func updateOrRemove(f: (inout Element?)->Void) { withUnsafeMutableBufferPointer { var src = $0.baseAddress! var dst = $0.baseAddress! for _ in 0..<$0.count { var e: Element? = src.pointee f(&e) if let e = e { dst.pointee = e dst += 1 } src += 1 } } } } これ+カウント書き換えならそこそこかな? (edited)
8:10 AM
なんかarray縮めるやつありますよね