deleting an element in a vector of pointer
<p>I just want to make sure if this is the right way to delete an allocated memory where there exist an element in the vector that pointing to that object;</p>

<pre><code>vector&lt;Fruit*&gt; temp;
</code></pre>

<p>let say if the sixth element in the vector is pointing to the object that I want to delete.</p>

<pre><code>Fruit* a = temp[5];
temp.erase(temp.begin()+5);
delete a;
</code></pre>

<p>is this right? thx</p>
