It is possible to force the type parameters of a generic class to implement a protocol, for example, [Equatable](<https://developer.apple.com/library/ios/documentation/Swift/Reference/Swift_Equatable_Protocol/index.html>)
<Type: Equatable>TypeTypeTypeType
Whenever we create a new MyGenericClass
, the type parameter has to implement the Equatable
protocol (ensuring the type parameter can be compared to another variable of the same type using ==
)
DoubleString[Int]Int