title: How can I get the memory address of a value type or a custom struct in Swift?
body: <p>I'm trying to gain a deeper understanding of how Swift <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html#//apple_ref/doc/uid/TP40014097-CH13-XID_134" rel="noreferrer">copies value types</a>:</p>
  
  <blockquote>
    <p>The behavior you see in your code will always be as if a copy took
    place. However, Swift only performs an actual copy behind the scenes
    when it is absolutely necessary to do so.</p>
  </blockquote>
  
  <p>To advance my understanding, I'd like to get the memory address of a value type.  I tried unsafeAddressOf(), but <a href="https://stackoverflow.com/a/32639254/245948">this doesn't work with structs and it seems to cast Swift's standard library types to reference types</a> (e.g. String is cast to NSString).  </p>
  
  <p><strong>How can I get the memory address of a value type, like an instance of Int, or a custom struct in Swift?</strong></p>