What does T equal to T in Generics

I am learning the new Apple language quickly, and I looked at the Swift module,
and saw that some common classes have the following statements:

extension ContiguousArray<T> : ArrayType {

    /// Construct an empty ContiguousArray
    init()
    init<S : Sequence where T == T>(_ s: S) 

    /* other statement skipped */
}  

I wonder what it means Where T == T?
I could not understand if anyone could help me?

+4
source share
1 answer

T is a reference to any type. This allows you to dynamically set the type for something ... like an array. T == T is similar to the expression typeof (Int) == typeof (Int) in obj c

+1
source

Source: https://habr.com/ru/post/1546942/


All Articles