[swift-dev] Is SE-0138 UnsafeRawBufferPointer included in Xcode 8 beta 3?
Norio Nomura
norio.nomura at gmail.com
Tue Oct 11 19:13:20 CDT 2016
The release notes of Xcode 8.1 beta 3 said:
> Two types have been added to the Swift standard library: UnsafeRawBufferPointer
and UnsafeMutableRawBufferPointer.
But I'm getting errors on building sample codes in release notes:
```
*➜ **9:10:46 * DEVELOPER_DIR=/Applications/Xcode-beta.app swift
Welcome to Apple Swift version 3.0.1 (swiftlang-800.0.56 clang-800.0.42).
Type :help for assistance.
1> struct Header {
2. var x: Int
3. var y: Float
4. }
5.
6. var header = Header(x: 0, y: 0.0)
7. var byteBuffer = [UInt8]()
8. withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
9. byteBuffer += bytes
10. }
11.
12. let intArray = [1, 2, 3]
13.
14. intArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
15. byteBuffer += bytes
16. }
error: repl.swift:8:1: error: use of unresolved identifier 'withUnsafeBytes'
withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
^~~~~~~~~~~~~~~
error: repl.swift:8:40: error: use of undeclared type
'UnsafeRawBufferPointer'
withUnsafeBytes(of: &header) { (bytes: UnsafeRawBufferPointer) in
^~~~~~~~~~~~~~~~~~~~~~
error: repl.swift:14:36: error: use of undeclared type
'UnsafeRawBufferPointer'
intArray.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
^~~~~~~~~~~~~~~~~~~~~~
1>
```
Am I missing something needed for using them?
Thanks,
Norio Nomura @norio_nomura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161012/efa83a61/attachment.html>
More information about the swift-dev
mailing list