title: Prevent possible exception at std::list addition time
body: <p>I currently have a std::list that stores std::size_ts. I use a std::list (instead of a vector) because I don't need random access; I just keep appending to the end of the list, and I will only need to iterate through it once to go through the content before program terminates to perform some clean-up.</p>
  
  <p>If this is what I have, I was wondering if additions to the list can cause exceptions?</p>
  
  <pre><code>std::list&lt;std::size_t&gt; dataList;
  std::size_t t= GetSomeDataEmbeddedInSizeT();
  // do some things
  dataList.emplace_back(t); // can this generate exceptions?
  </code></pre>
  
  <p>It seems like exceptions are possible since emplace_back (or other addition APIs such as push_back) will construct a new object (in-place), but since std::size_t is like a primitive type, I wanted to confirm. And if exceptions are possible, what's the best way to prevent that from happening at addition time? I'd like to handle the exceptions at allocation time (i.e. GetSomeDataEmbeddedInSizeT()) so I can centralize all the exception-handling logic.</p>
  
  <p>Thanks.</p>