> On Jun 2, 2016, at 11:04 AM, Erica Sadun <[email protected]> wrote:
> 
> 
>> On Jun 2, 2016, at 9:48 AM, Matthew Johnson via swift-evolution 
>> <[email protected] <mailto:[email protected]>> 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. :)

Thanks!  Can you change the init signature with Pyry’s improvement: `init(_: 
@autoclosure () -> T) {}`?

> 
> - E
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to