title: How to throw std::exceptions with variable messages?
body: <p>This is an example of what I often do when I want to add some information to an exception:</p>
  
  <pre><code>std::stringstream errMsg;
  errMsg &lt;&lt; "Could not load config file '" &lt;&lt; configfile &lt;&lt; "'";
  throw std::exception(errMsg.str().c_str());
  </code></pre>
  
  <p>Is there a nicer way to do it?</p>