SequenceType
protocol을 이해하려고 노력 :SequenceType.dropFirst (_ :)가 Self 대신 Self.SubSequence를 반환하는 이유
protocol SequenceType {
associatedtype SubSequence
@warn_unused_result func dropFirst(_ n: Int) -> Self.SubSequence
/* ... */
}
을 우리가 이제까지 associatedtype SubSequence
필요한 이유, 왜 안 Self
, SequenceType
?
예를 들어'someArray.dropFirst()'는'Array'가 아닌'ArraySlice'를 반환합니다. –
@ MartinR 고마워, 이제 내 마음 속에이 연결이있어. –