[swift-users] Custom little/big endian data structure.

Chris Lattner clattner at apple.com
Tue Nov 1 12:33:04 CDT 2016


> On Oct 30, 2016, at 12:50 PM, Adrian Zubarev via swift-users <swift-users at swift.org> wrote:
> 
> Hi there,
> 
> is there actually a way to build a custom data structure that will automatically be converted to little/big endian on a little/big endian system, just like (U)Int16/32/64 do?
> 
> I could build as a workaround a mechanism that will do that for me, but I’m curious if this is possible with some workaround. 

Hi Adrian,

This isn’t something that Swift provides a magic answer to today, but it seems possible that the “property behaviors” proposal (which is currently shelved, but will hopefully come back in the future) could be used to address this.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161101/b2a3dd5e/attachment.html>


More information about the swift-users mailing list