Is there any possible memory leak in this code?
<p>Josuttis shows an example about a possible allocator use (chapter 15):</p>

<pre><code>void vector&lt;T,Allocator&gt;::reserve(size_type size)
{
    //allocate new memory for size elements
    T* newmem = alloc.allocate (size);
    //copy old elements into new memory
    uninitialized_copy(elems,elems+numElems,newmem);
</code></pre>

<p>What happens if uninitialized_copy fails? Is there any memory leak or is <code>::operator delete</code> magically called (see the comment in the code below):</p>

<pre><code>  template &lt;class InputIter, class ForwIter&gt;
  ForwIter uninitialized_copy(lnputIter beg, InputIter end, ForwIter dest)
  {
    typedef typename iterator_traits&lt;ForwIter&gt;::value_type VT;
    ForwIter save(dest);
    try {
       for (; beg!=end; ++beg,++dest) {
           new (static_cast&lt;void*&gt;(&amp;*dest))VT(*beg);
       }
       return dest;
    }
    catch (...) {
       for (; save!=dest; ++save) {
           save-&gt;~VT();
       }
       throw; // will ::operator delete() be called to free the previously allocated memory?
    }
 }
</code></pre>
