title: memory management & std::allocator
body: <p>In reviewing my code I see some "ugly" structure I use, in a class (called "map") I have a vector which contains a "data" class:</p>
  
  <pre><code>std::vector&lt;PointerToHUGEClass&gt; vector;
  </code></pre>
  
  <p>Where PointerToHUGEClass is just like the name describes. (though the object pointed too is also owned by the map class, and created with the "new" parameter in the constructor). This works all good (at the moment). However I still feel it is more of a work-around.</p>
  
  <p>The <strong>only</strong> reason I am using a "PointerToHUGEClass" instead of just "HUGEClass", is because I wanted to make sure the object is not declared from the stack. This was made however before I understood allocaters. Now I feel it is more or less the task of the allocator to ensure the memory isn't declared from the stack.</p>
  
  <p><em>My questions:</em></p>
  
  <ul>
  <li>Am I correct in assuming the allocator is responsible for the memory management from the items? (And making sure it is declared from stack/freestore/heap/whatever)</li>
  <li>What does the std::allocator do? - Does it declare from the stack, or from the heap?</li>
  <li>(follow up from previous question): if I copy an item declared in the stack to the datastructure is it still declared in the heap?</li>
  </ul>
  
  <p>Thanks again,
  paul23</p>