title: C++ constexpr type ID
body: <p>I notice that the <code>typeid(T)</code> call provides a nice constexpr-compatible way to retrieve a unique identifier for a given class at compile-time. This is very useful, but I notice that relational operators between the <code>type_info</code> objects which this yields are not enabled at compile-time. This makes sense, since the actual IDs may vary at runtime. However, I would like to impose an ordering between types such that:</p>
  
  <ol>
  <li>Every type has some unique ID which is generated at compile-time. It does <em>not</em> matter what these IDs are, or how they are ordered between classes.</li>
  <li>For each pair of types, the IDs between the types can be compared relationally to determine which type has the "lesser" ID.</li>
  <li>It <strong>does not</strong> matter if the order of the IDs changes between compilations.</li>
  </ol>
  
  <p>This is very doable at compile-time by explicitly defining the IDs for each type. However, I was wondering if there is a more reasonable approach to generate compile-time, constexpr-compatible IDs per type which allow for relational operations.</p>
  
  <p>Thanks!</p>