title: std::allocator construct/destroy vs. placement new/p->~T()
body: <p>For a project of mine, I am writing some STL containers from scratch (I have my reasons). Since I am mimicking the functionality and interfaces of the STL so closely I am doing my best to keep with the policy "if it has the same name as a standard construct, it will conform to the standard as much as possible."</p>
  
  <p>So, of course my containers take allocators as a template parameter, which is very nice as it allows for some custom allocation schemes. On to my question.</p>
  
  <p>The <code>std::allocator</code> interface separates memory allocation from object construction. Likewise it separates deallocation from destruction. This makes sense since where you get memory from is more or less irrelevant to properly constructing an object in c++.</p>
  
  <p>So there are two construction/deallocation functions which look like this for the default implementation (lifted straight from a book):</p>
  
  <pre><code>void construct(pointer p, const T&amp; val)    { new(p) T(val); }
  void destroy(pointer p)                    { p-&gt;~T(); }
  </code></pre>
  
  <p>as you can see construct simply calls placement new and destroy simply calls the destructor.</p>
  
  <p>Is there any reason to use these over just using placement new and destructor syntax? can a "correct" allocator implement these in another way? Or am I guaranteed that all allocator implementations which conform to the standard will have there construct/destroy methods implemented in this way?</p>
  
  <p>More to the point, is it safe to say that I can always use the <code>std::uninitialized_copy</code> and <code>std::uninitialized_fill</code> for constructing the elements of my containers?</p>
  
  <p>Thanks.</p>