title: Get enum value from key stored in a variable
body: <p>If I have an enumeration like</p>
  <pre class="lang-cpp prettyprint-override"><code>enum values {
  
  
     var1 = 12,
  
     var2 = 23,
  
     var3 = 34
  };
  </code></pre>
  <p>is it possible to get the value from</p>
  <pre class="lang-cpp prettyprint-override"><code>  string str = &quot;var2&quot;;
  
    // Get values::str;
  </code></pre>
  <p>I have tried creating an enum variable and assigning the variable str to it, but this gives a type mismatch error.</p>