title: How to print additional information when assert fails?
body: <p>Often one wants to print out additional information if an <code>assert</code> fails. A way to do that is this:</p>
  
  <pre><code>assert(vec.size() &gt; i || 
    !(std::cerr &lt;&lt; "False: " &lt;&lt; vec.size() &lt;&lt; "&gt;" &lt;&lt; i))
  </code></pre>
  
  <p>This way the actual sizes are printed when the <code>assert</code> fails. But it's ugly, and also it's easy to forget the <code>!</code> , which will make the assertion condition true and the program will just continue.</p>
  
  <p>What do people use instead to print additional information on assertion failure, like above?</p>