Swift 5 MemoryLayout
作者:
鬼把戏 | 来源:发表于
2019-10-08 10:02 被阅读0次
MemoryLayout
var age = 10
MemoryLayout<Int>.size //实际占用的内存大小
MemoryLayout<Int>.stride //分配的内存大小
MemoryLayout<Int>.alignment //内存对齐参数
MemoryLayout<Int>.size(ofValue: age)
MemoryLayout<Int>.stride(ofValue: age)
MemoryLayout<Int>.alignment(ofValue: age)
enum Season {
case spring, summer
}
var s = Season.spring
MemoryLayout<Season>.size(ofValue: s)
MemoryLayout<Season>.stride(ofValue: s)
MemoryLayout<Season>.alignment(ofValue: s)
本文标题:Swift 5 MemoryLayout
本文链接:https://www.haomeiwen.com/subject/luvqyctx.html
网友评论