title: Is it safe to use an enum to index an array?
body: <p>Is it safe to use an enum to index an array?
  For example:</p>
  
  <pre><code>void messageToCerr( QtMsgType type,
                  const QMessageLogContext&amp; context,
                  const QString&amp; msg
                ) {
  QVector&lt;QString&gt; typeName = {"Debug", "Warning", "Critical", "Fatal", "Info"};
  QString output = QString( "[%1] %2" ).arg( typeName.at(type) ).arg( msg );
  std::cerr &lt;&lt; output.toStdString() &lt;&lt; std::endl;
  if ( type == QtMsgType::QtFatalMsg ) {
  
      abort();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Is using "type", which is</p>
  
  <pre><code>enum QtMsgType { QtDebugMsg, QtInfoMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg }
  </code></pre>
  
  <p>like an array (vector) index is safe?
  I read that traversing enum like array is unsafe.</p>