mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
9 lines
289 B
Swift
9 lines
289 B
Swift
// RUN: %target-swift-frontend -emit-ir %s
|
|
|
|
public func withOptionalsAsPointers<T, each Opt>(
|
|
_ optional: repeat Optional<each Opt>,
|
|
body: (repeat UnsafePointer<each Opt>?) throws -> T
|
|
) rethrows -> T {
|
|
return try body(repeat (each optional).map { withUnsafePointer(to: $0) { $0 } })
|
|
}
|