title: Delete a pointer array without deleting the pointed objects in memory?
body: <p>I would like to know if there is a way to delete a pointer array without touching the pointed objects in memory.</p>
  
  <p>I'm writing a restriction routine for a <code>HashSet</code> I implemented a couple of days ago, so when the hash table is full it gets replaced by another double sized table. I'm representing the hash table using an array of pointers to an object (<code>User</code>), and the array itself is declared dynamically in my <code>HashSet</code> class, so it can be deleted after copying all its content to the new table using a hash function.</p>
  
  <p>So basically I need to:</p>
  
  <ol>
  <li>Declare another table with a size that equals the double of the original array size.</li>
  <li>Copy every pointer to <code>User</code> objects from my original array to the new one applying my hash function (it gets the <code>User</code> object from memory and it calculates the index using a string that represents the user's name).</li>
  <li>After inserting all the pointers from the original array to the new one, I will have to free the allocated memory for the original array and replace the pointer in my HashSet class (member private <code>userContainer</code>) with the location of the new one (array).</li>
  </ol>
  
  <p>The problem is that if I use <code>delete[] userContainer</code> to free the allocated memory for it, it will also delete every object in memory so the newly created replacement array will point to freed positions in memory!</p>