> Matthew Johnson wrote:
>
> Going with MemoryLayout *does not* mean we would have to give up the value
> functions if we don’t want to:
>
> struct MemoryLayout<T> {
> init(t: T) { /* throw away the value */ }
> // …
> }
>
> let sizeOfValue = MemoryLayout(42).size
You could also use @autoclosure here to avoid evaluating whatever expression
there is:
struct MemoryLayout<T> {
init(_: @autoclosure () -> T) {}
// ...
}
— Pyry
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution