[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue

Erica Sadun erica at ericasadun.com
Thu Jun 2 11:04:23 CDT 2016


> On Jun 2, 2016, at 9:48 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> 
> struct MemoryLayout<T> {
>     init() {}
>     init(t: T) { /* throw away the value */ }
>     
>     // we could omit the static properties and require 
>     // writing MemoryLayout<Int>() if we don’t like the duplication
>     static let size: Int
>     static let spacing: Int
>     static let alignment: Int
> 
>     let size: Int
>     let spacing: Int
>     let alignment: Int
> }
> 
> let size = MemoryLayout<Int>.size
> let sizeOfValue = MemoryLayout(42).size

And amended Alternatives with this. :)

- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160602/92b91233/attachment.html>


More information about the swift-evolution mailing list