title: Does set::insert saves a copy or a pointer C++
body: <p>does the function <code>set::insert</code> saves a pointer to the element or a copy of it. meaning, can I do the following code, or I have to make sure that the pointers are not deleted?</p>
  
  <pre><code>int *a;
  *a=new int(1);
  set&lt;int&gt; _set;
  _set.insert (*a);
  delete a;
  *a=new int(2);
  _set.insert (*a);
  delete a;
  </code></pre>
  
  <p>I gave the example with <code>int</code>, but my real program uses classes that I created.</p>