title: compile time typeid for every type
body: <p>I'd like a <code>constexpr</code> function that will return me a unique id for every C++ type, something like this:</p>
  
  <pre><code>using typeid_t = uintptr_t;
  
  template &lt;typename T&gt;
  constexpr typeid_t type_id() noexcept
  {
    return typeid_t(type_id&lt;T&gt;);
  }
  
  int main()
  {
    ::std::cout &lt;&lt; ::std::integral_constant&lt;typeid_t, type_id&lt;float&gt;()&gt;{} &lt;&lt; ::std::endl;
  
    return 0;
  }
  </code></pre>
  
  <p>But I get an error:</p>
  
  <pre><code>t.cpp: In function 'int main()':
  t.cpp:23:69: error: conversion from pointer type 'typeid_t (*)() noexcept {aka long unsigned int (*)() noexcept}' to arithmetic type 'typeid_t {aka long unsigned int}' in a constant-expression
     ::std::cout &lt;&lt; ::std::integral_constant&lt;typeid_t, type_id&lt;float&gt;()&gt;{} &lt;&lt; ::std::endl;
                                                                       ^
  t.cpp:23:69: note: in template argument for type 'long unsigned int' 
  </code></pre>
  
  <p>Is there a workaround or another way?</p>