Swift泛型
swift 特性, 可以定义泛型类型
func SwapTwoValues <T>(value1: inout T, value2: inout T) {
let p = value1
value1 = value2
value2 = p
}
参数为泛型,
var a1 = "hello"
var a2 = "world"
SwapTwoValues(value1: &a1, value2: &a2)
var a = 55
var b = 44
SwapTwoValues(value1: &a, value2: &b)