[swift-users] Rebind tuple to its destructured base type

Kelvin Ma kelvin13ma at gmail.com
Sat Jan 13 00:59:03 CST 2018

I have an array of matrices where the matrix type is defined as

typealias Vec4 = (Float, Float, Float, Float)
typealias Mat4 = (Vec4, Vec4, Vec4, Vec4)

let matrices:[Mat4]

I need to send them to an OpenGL API that accepts a buffer of Floats. How
do I do this? withMemoryRebound(to:_:) requires the source type and the
destination type to be the same size,, while each Mat4 is 16 times the size
of Float.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20180113/a979343f/attachment.html>

More information about the swift-users mailing list