title: std::cout equivalent at compile time, or static_assert stringification of compile-time constant values in c++11
body: <p>Is there a way to print the value of a <code>constexpr</code> or <code>#define</code>d value at compile time?  I want the equivalent of <code>std::cout &lt;&lt;</code>, or some way to do something like</p>
  
  <pre><code>constexpr int PI_INT = 4;
  static_assert(PI_INT == 3,
                const_str_join("PI_INT must be 3, not ", const_int_to_str(PI_INT)));
  </code></pre>
  
  <p><strong>Edit:</strong> I can do some basic compile-time printing with <code>constexpr</code>s, at least on gcc by doing something like</p>
  
  <pre><code>template &lt;int v&gt;
  struct display_non_zero_int_value;
  
  template &lt;&gt;
  struct display_non_zero_int_value&lt;0&gt; { static constexpr bool foo = true; };
  
  static constexpr int v = 1;
  
  static_assert(v == 0 &amp;&amp; display_non_zero_int_value&lt;v&gt;::foo, "v == 0");
  </code></pre>
  
  <p>which gives me <code>error: incomplete type ‘display_non_zero_int_value&lt;1&gt;’ used in nested name specifier static_assert(v == 0 &amp;&amp; display_non_zero_int_value&lt;v&gt;::foo, "v == 0");</code>.  (icpc, on the other hand, is less helpful, and just says <code>error: incomplete type is not allowed</code>)  Is there a way to write a macro that can generalize this so that I can do something like</p>
  
  <pre><code>constexpr int PI_INT = 4;
  PRINT_VALUE(PI_INT)
  </code></pre>
  
  <p>and get an error message that involves 4, somehow?</p>