Created
May 19, 2019 16:20
-
-
Save pofat/bf5cbed3fd3b172954dccc1819d47e8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol MyProcotol {} | |
struct MyStruct { | |
let x = 1 | |
let y = 2 | |
} | |
// What's the difference of following two? | |
let existentialContainer: MyProtocol = MyStruct() | |
let structInstance = MyStruct() | |
print(MemoryLayout.size(ofValue: existentialContainer)) // 40 | |
print(MemoryLayout.size(ofValue: structInstance)) // 16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment