title: Is there a standard name / templated prototype for "congruent hash" vs "identity hash"?
body: <p>I have a templated class <code>Foo</code> that can do identity comparisons (via <code>==</code>), but has a function <code>Foo::sameStructureAs(Foo const &amp; other)</code> for more of a "value" vs. "pointer" notion of equality.</p>
  
  <p>I'd like to make an <a href="http://en.cppreference.com/w/cpp/container/unordered_map" rel="nofollow"><code>unordered_map</code></a> which overrides the hash function and the equality predicate.  They default to <code>std::equal_to&lt;Key&gt;</code> and <code>std::hash&lt;Key&gt;</code>...which I provide for my type, based on identity.  But I need them to be comparing on the basis of my <code>sameStructureAs</code>.</p>
  
  <p>Since Foo is a template, I do something like this:</p>
  
  <pre><code>template &lt;class&gt; struct same_structure_as;
  
  template &lt;class&gt; struct hash_structure;
  
  template &lt;class T&gt;
  struct hash_structure&lt;Foo&lt;T&gt;&gt;
  {
      size_t operator() (Foo&lt;T&gt; const &amp; value) const
      {
          // whatever...
      }
  };
  
  template &lt;class T&gt;
  struct same_structure_as&lt;Foo&lt;T&gt;&gt;
  {
      bool operator() (Foo&lt;T&gt; const &amp; left, Foo&lt;T&gt; const &amp; right) const
      {
          // whatever...
      }
  };
  </code></pre>
  
  <p>Which seems like I'm following roughly the strategy of the classes in <code>std::</code> for this purpose, and creating something general.  So does that look right?</p>
  
  <p>Secondly: Is there any precedent for the naming of this or a prototype already existing in std::?  I've thought about words like <code>isomorphic</code> or <code>congruent</code>.  It seems like something that would come up often in designing classes when you have more than one idea of what it means to be "equal".</p>