title: How to get a templated typename as a string?
body: <p>The following code prints out the string "T" not the actual typename when the templated function is called. Is there a way to get the real typename without adding anything to the types being templated?</p>
  
  <pre><code>#define stringify(a) #a
  #define tostring(a) stringify(a)
  
  template &lt;typename T&gt;
  void function_foo(T a, T b)
  {
      cout &lt;&lt; tostring(T) &lt;&lt; endl;
      ...
  }
  </code></pre>