结构SinkOf实现中T == T的含义是什么? (SWIFT)

时间:2015-08-09 08:13:00

标签: swift generics

任何人都可以帮忙吗?以下是swift标准库的引用。

/// A type-erased sink.
///
/// Forwards operations to an arbitrary underlying sink with the same
/// `Element` type, hiding the specifics of the underlying sink type.
struct SinkOf<T> : SinkType {

    /// Construct an instance whose `put(x)` calls `putElement(x)`
    init(_ putElement: (T) -> ())

    /// Construct an instance whose `put(x)` calls `base.put(x)`
    init<S : SinkType where T == T>(_ base: S)

    /// Write `x` to this sink.
    func put(x: T)
}

0 个答案:

没有答案