title: Best way to compare std::strings
body: <p>What is the best way to compare <code>std::string</code>s? The obvious way would be with <code>if</code>/<code>else</code>:</p>
  
  <pre><code>std::string input;
  std::cin &gt;&gt; input;
  
  if ( input == "blahblahblah" )
  {
      // do something.
  }
  
  else if ( input == "blahblah" )
  {
      // do something else.
  }
  
  else if ( input == "blah" )
  {
      // do something else yet.
  }
  
  // etc. etc. etc.
  </code></pre>
  
  <p>Another possibility is to use an <code>std::map</code> and a <code>switch</code>/<code>case</code>. What is the best way when doing lots (like 8, 10, 12+) of these comparisons?</p>