//Swift 5.1
func testFunc() {
	var abc = [(Int, Int)](repeatElement((0,0), count: 10))
	func testInnerFunc(a: inout Int, b: inout Int) {
		a = 2
		b = 2
	}
	testInnerFunc(a: &abc[0].0, b: &abc[0].1) //ERROR 🔴
}

func testFunc2() {
	var abc = [[0,0],[0,0]]
	func testInnerFunc(a: inout Int, b: inout Int) {
		a = 2
		b = 2
	}
	testInnerFunc(a: &abc[0][0], b: &abc[0][1]) //ERROR 🔴
}

コメントを残す

WordPress.com で次のようなサイトをデザイン
始めてみよう