title: Too many if/else statements in converting user inputs to types in C++
body: <p>I have a template class with 3 template arguments.</p>
  
  <pre><code>template &lt;class T, class U, class Y&gt;
  class MyClass {};
  </code></pre>
  
  <p>I wanna get input from users by CLI arguments, something like <code>./cli float driver-x load</code></p>
  
  <ul>
  <li>The first arg can be <code>float</code> or <code>double</code></li>
  <li>The second arg is a driver name: <code>driver-x</code>, <code>driver-y</code>, ...</li>
  <li>The third argument is about the action type: <code>load</code>, <code>unload</code>, ...</li>
  </ul>
  
  <p>If I want to create a new instance of <code>MyClass</code> based on user inputs, I have to define many <code>if/else</code> statements. Because a user inputs are <code>string</code> and I have to prepare a condition on them.
  So, it will be something like this:</p>
  
  <pre><code>if (data_type == "float")
      if (driver == "driver-x")
          if (action == "load")
              MyClass&lt;float, DriverX, Load&gt; t;
              t......
  </code></pre>
  
  <p>As far as I know, it's impossible to store a type in a variable in C++.</p>
  
  <p>So, is there any way exists to improve the <code>if/else</code> statements? Something like:</p>
  
  <pre><code>if (data_type == "float")
      //
  
  if (driver == "driver-x")
     //
  
  if (action == "load")
     //
  
  MyClass&lt;......&gt; t;
  t.....;
  </code></pre>
  
  <p>Or any other way?</p>
  
  <p>I'm looking for a way to improve these <code>if/else</code> statements.</p>