title: Multiply chars of a string at compile time (in enumeration)
body: <p>currently I am doing the following:</p>
  
  <pre><code>enum TC_ID {
     CMD01 = 'C'*'M'*'D'*'0'*'1',
     CMD02 = 'C'*'M'*'D'*'0'*'2',
     ..
  };
  </code></pre>
  
  <p>Which works, but is going to be quite effortfull for a whole lot of commands :D</p>
  
  <p>So, I am looking for a Macro, or inline function or something else which multiplies all the chars of a char array/string with a fixed size, so that I don't have to type them in manually in my code.</p>
  
  <p>Is something like this possible?</p>
  
  <hr>
  
  <p>Some unnecessary but maybe interesting information:</p>
  
  <p>Well, this looks kinda stupid, why am I doing this you might ask ;)</p>
  
  <p>My goal is to use this enum in a switch statement, which in the end is used to execute telecommands for my project.</p>
  
  <p>The size of my telecommands is always 5.
  So I am calculating some kind of very simple hash value which will be used inside the switch statement:</p>
  
  <pre><code>char *id // contains the Telecommand as a string
  TC_ID hash = static_cast&lt;TC_ID&gt;(id[0]*id[1]*id[2]*id[3]*id[4]);
  
  switch (hash) {
      case (CMD01):
          // execute funtion..
          break;
      case (CMD02):
          // do something else
          break;
      default:
          // unknown command
  }
  </code></pre>
  
  <p>I know that instead of a switch I could just use a lot of if else statements and strcmp, but I don't want to because it's ugly :D</p>
  
  <p>EDIT: Also, using an appropriate hash function would be much better. </p>
  
  <p>However, how can this be implemented in an enumeration, so that I can still use my switch statement for the commands?</p>
  
  <p>I think what I want is basically some kind of hash table which I can generate at the start for all command words and then make a switch over all of them.. but just how?</p>
  
  <p>EDIT2: My compiler version is C++98</p>
  
  <p>EDIT3: Workaround solution in comment in answer post</p>