title: Efficient way to truncate string to length N
body: <p>For example, suppose I have <code>std::string</code> containing UNIX-style path to some file:</p>
  
  <pre><code>string path("/first/second/blah/myfile");
  </code></pre>
  
  <p>Suppose now I want to throw away file-related information and get path to 'blah' folder from this string. So is there an efficient (saying 'efficient' I mean 'without any copies') way of truncating this string so that it contains <code>"/first/second/blah"</code> only?</p>
  
  <p>Thanks in advance.</p>