Created
March 19, 2016 19:41
-
-
Save Danappelxx/b4ca59ab5d3726a00e22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let length = 10 | |
let ptr = UnsafeMutablePointer<UInt8>(allocatingCapacity: length) | |
defer { ptr.deallocateCapacity(length) } | |
for i in 0..<length { | |
ptr.advanced(by: i).pointee = UInt8(i) | |
} | |
let buffer = UnsafeMutableBufferPointer(start: ptr, count: length) | |
let arr = Array(buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment