title: Padding stl strings in C++
body: <p>I'm using <code>std::string</code> and need to left pad them to a given width.  What is the recommended way to do this in C++?</p>
  
  <p>Sample input:</p>
  
  <pre><code>123
  </code></pre>
  
  <p>pad to 10 characters.</p>
  
  <p>Sample output:</p>
  
  <pre><code>       123
  </code></pre>
  
  <p><em>(7 spaces in front of 123)</em></p>