title: Swift compare memory addresses
body: <p>I want to compare the addresses of two Swift objects, like:</p>
  
  <pre><code>let a: AnyObject
  let b: AnyObject
  
  a &lt; b
  </code></pre>
  
  <p>Of course this is not possible like this but I’m not able to find any way to achieve this.</p>
  
  <p>I could just implement a C function to do this </p>
  
  <pre><code>bool compare(NSObject *a, NSObject *b){
      return a &lt; b;
  }
  </code></pre>
  
  <p>and then call it like</p>
  
  <pre><code>compare(a, b)
  </code></pre>
  
  <p>but this limits me to use <code>NSObjects</code>.</p>
  
  <p>So my question is: Is there any way to achieve this purely in Swift?</p>