title: Make class type a Dictionary key (Equatable, Hashable)
body: <p>Say I have a class named <code>LivingCreature</code>
  And other classes that inherit from it:</p>
  
  <ul>
  <li><p><code>Human</code></p></li>
  <li><p><code>Dog</code></p></li>
  <li><p><code>Alien</code></p></li>
  </ul>
  
  <p>This is what I'm trying to accomplish:</p>
  
  <pre><code>let valueForLivingCreature = Dictionary&lt;Alien, String&gt;
  </code></pre>
  
  <p>And access it like so:</p>
  
  <pre><code>let alienValue = livingCreatureForValue[Alien]
  </code></pre>
  
  <p>But this means the class should conform to <code>Equatable</code> and <code>Hashable</code>, but the class itself, not the class instance.
  I've tried various ways of accomplishing this, but no luck.</p>
  
  <p>As a compromise I've came up with is:</p>
  
  <pre><code>typealias IndexingValue = Int
  class LivingCreature {
       static var indexingValue: IndexingValue = 0 
  }
  </code></pre>
  
  <p>And then I can use the class as a key like so:</p>
  
  <pre><code> let livingCreatureForValue = Dictionary&lt;IndexingValue, String&gt;
  </code></pre>
  
  <p>Access:</p>
  
  <pre><code>let alienValue = livingCreatureForValue[Alien.indexingValue]
  </code></pre>
  
  <p>But, this way the IndexingValue should be set per class, by hand.
  I would like to make a hash from the class itself like so:</p>
  
  <pre><code>class LivingCreature {
      static var indexingValue: IndexingValue {
          return NSStringFromClass(self).hash
      }
  }
  </code></pre>
  
  <p>This is not possible because <code>self</code> is not accessible is static var.</p>
  
  <p>My question is, is there a better way of addressing this kind of issue?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>@Paulw11 Asked me why not make LivingCreature confirm to Equatable and Hashable,
  The reason is I would not be able to access the value by the class type reference.
   I would have to alloc an instance every time:</p>
  
  <pre><code>let alienValue = livingCreatureForValue[Alien()]
  </code></pre>
  
  <p>I do not want to call "Alien()" every time for finding a value.
  And the component that uses it, doesn't care about the livingCreature instance, only about the class type.</p>