BitwiseOperationsType中的自我是什么?它是一种类型吗?
protocol BitwiseOperationsType {
func &(_: Self, _: Self) -> Self
func |(_: Self, _: Self) -> Self
func ^(_: Self, _: Self) -> Self
prefix func ~(_: Self) -> Self
/// The identity value for "|" and "^", and the fixed point for "&".
///
/// ::
///
/// x | allZeros == x
/// x ^ allZeros == x
/// x & allZeros == allZeros
/// x & ~allZeros == x
///
class var allZeros: Self { get }
}
答案 0 :(得分:5)
Self是“声明符合此协议的类型”。因此,如果你有一个符合BitwiseOperationsType的类Foo,那么&因为Foo被定义为将两个Foos作为参数。