I noticed that when there is a generic class, there is a , which I decided must use T for "Type". What does the S mean in . I see it in the function definition for the instance function initialize(from: S) -> (S.Iterator, UnsafeMutableBufferPointer.Index) of UnsafeMutableBufferPointer.
ScottMichaud_LT wrote:
it sounds like
S
is what the person who wrote the code chose to mean "some other type that doesn't have to beT
".
Right.
Claude31 wrote:
In doc, I find only:
Agreed.
In this declaration:
-
<S>
introduces a typeS
-
S : Sequence
indicates thatS
must conform toSequence
-
Element == S.Element
indicates that the element type of the sequence,S.Element
, must matchElement
, that is, the element type of theUnsafeMutableBufferPointer
In short, the method in question can populate the buffer from any sequence whose elements match the buffer.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"