And in C++14 you can do away with the recursion and just use a `for` loop.<p>Compile-time hashing of strings can be used to create a string-switch:<p><pre><code>  constexpr unsigned int hash(const char* string)
  {
    &#x2F;&#x2F; hash the string
    ...
  }
</code></pre>
And then:<p><pre><code>  switch(hash(some_string))
  {
     case hash(&quot;Hacker News&quot;):
       break;

     case hash(&quot;Y-Combinator&quot;):
       break;

     default:
       break;
  }
</code></pre>
If there is a collision, you get a compile-time error due to a duplicate `case`.