title: Get first N elements of std::list?
body: <p>What is the correct and safe way to get a new list that is the first N elements of a std::list or the entire list if N >= the list size (and handles N = 0 as well)?</p>
  
  <p><strong>Update</strong></p>
  
  <p>In fact I don't necessarily need a new list, I just want to operate on the subset of the list in subsequent code.  I assume creating a new list is a reasonable way to do this (note list size will typically be under 50).</p>