c++: implementing the equal method - how to make sure the given object is not the same reference as this?
<p>Consider the following code snippet:</p>

<pre><code>bool SomeObject::equal(const SomeObject&amp; rhs) const
{
  if (this == &amp;rhs)
  {
    return true;
  }

  // check the state
}
</code></pre>

<p>The problem with this code is that <code>SomeObject</code> might override <code>operator&amp;</code> (or someone might add it in the future), which in turn may break this implementation.</p>

<p>Is it possible to test whether <code>rhs</code> and <code>*this</code> are the same object without being at the mercy of <code>operator&amp;</code> implementation?</p>
