title: Efficient way to map a long list of strings to enums
body: <p><em>(I am not sure how to correctly call my problem. Please edit the title if there as better way to state it)</em></p>
  
  <p>In an API I'm using I have a certain enumerator type with 2000+ enumarator values. My objective is to have a function that will take in a string and return the corresponding enumerator. (The enumerator values and the strings2 have almost the same names.)</p>
  
  <p>My idea was to have nested if statements like this:</p>
  
  <p>(<code>queriedEntityNameString</code> is a <code>std::string</code> and <code>queriedEntityType</code> is a enum type)</p>
  
  <pre><code>//P
  if (queriedEntityNameString[0] == 'p'){
  
      //PO
      if (queriedEntityNameString[1] == 'o'){
  
          if (queriedEntityNameString == "point")
              queriedEntityType = et_point;
  
          else if (queriedEntityNameString == "pocket")
              queriedEntityType = et_pocket;
  
          else if (queriedEntityNameString == "point_on_curve")
              queriedEntityType = et_point_on_curve;
  
  
      }
      //PR
      else if (queriedEntityNameString[1] == 'r'){
  
          if (queriedEntityNameString == "product")
              queriedEntityType = et_product;
  
          else if (queriedEntityNameString == "product_definition")
              queriedEntityType = et_product_definition;          
  
          else if (queriedEntityNameString == "product_definition_formation")
              queriedEntityType = et_product_definition_formation;
  
      }
  
  }
  //Q
  else if (queriedEntityNameString[0] == 'q'){
      //QU
      if (queriedEntityNameString[1] == 'u'){
  
          if (queriedEntityNameString == "qualified_representation_item")
              queriedEntityType = et_qualified_representation_item;
  
          else if (queriedEntityNameString == "quantified_assembly_component_usage")
              queriedEntityType = et_quantified_assembly_component_usage;
  
      }
  }
  </code></pre>
  
  <p>Obviously setting this up for 2000 cases manually is "impossible". I could write up a little script that could do this for me, but is this sort script available somewhere?</p>
  
  <p>My second idea was to put everything in a std::map, but I'm not sure how efficient it would be.</p>
  
  <p>I would like any suggestions on the best way to approach this problem.</p>