[swift-evolution] [swift-evolution-announce] [Review] SE-0147: Move UnsafeMutablePointer.initialize(from:) to UnsafeMutableBufferPointer

Ben Cohen ben_cohen at apple.com
Thu Dec 8 14:33:27 CST 2016


> On Dec 8, 2016, at 10:24 AM, Alex Martini via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Dec 7, 2016, at 10:07 PM, Douglas Gregor <dgregor at apple.com <mailto:dgregor at apple.com>> wrote:
>> 
>> Hello Swift community,
>> 
>> The review of SE-0147 "Move UnsafeMutablePointer.initialize(from:) to UnsafeMutableBufferPointer" begins now and runs through December 12, 2016. The proposal is available here:
>> 
>> https://github.com/apple/swift-evolution/blob/master/proposals/0147-move-unsafe-initialize-from.md <https://github.com/apple/swift-evolution/blob/master/proposals/0147-move-unsafe-initialize-from.md>
> extension UnsafeMutableBufferPointer {
>   /// Initializes memory in the buffer with the elements of `source`.
>   /// Returns an iterator to any elements of `source` that didn't fit in the 
>   /// buffer, and an index to the point in the buffer one past the last element
>   /// written (so `startIndex` if no elements written, `endIndex` if the buffer 
>   /// was completely filled).
>   ///
>   /// - Precondition: The memory in `self` is uninitialized. The buffer must contain
>   ///   sufficient uninitialized memory to accommodate `source.underestimatedCount`.
>   ///
>   /// - Postcondition: The returned iterator
>   /// - Postcondition: The `Pointee`s at `self[startIndex..<initializedUpTo]` 
>   ///   are initialized.
> 
> 
> It looks like the first postcondition got cut off.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

Thanks Alex, sorry about that. This should probably read “The returned iterator will yield any remaining elements of the sequence not written to the buffer”. I’m not sure if this really needs to be a postcondition though, in addition to being the documented behavior of the return value.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161208/69a0804b/attachment.html>


More information about the swift-evolution mailing list