title: How does multiplication work for C++ enums?
body: <p>We have a template conversion function intended for use with numeric datatypes. Inside it contains a construct that makes it not compile with types like pointers.</p>
  
  <pre><code>template&lt;class To, class From&gt;
  To ConvertTo( From what )
  {
      assert( 2 * what == what * 2 ); // this will not compile for pointers
      //skipped
  }
  </code></pre>
  
  <p>This function compiles and works allright when a enum is passed as the second template parameter:</p>
  
  <pre><code>enum TSomeEnum {
     SE_First,
     SE_Second       
  };
  
  TSomeEnum enumValue = SE_First;
  int result = ConvertTo&lt;int&gt;( enumValue );
  </code></pre>
  
  <p>The above code compiles and runs as intended on VC++7.</p>
  
  <p>How does the operation * work for enums? Is it a way to undefined behaviour?</p>