how to destroy stl Queue created on heap?
<p>As per req i have to create stl queue on heap
i have created stl queue on heap in constructor of my class as per below code</p>

<pre><code>queue&lt;int&gt; *myqueue;
myqueue=new queue&lt;int&gt;();
</code></pre>

<p>Now in destructor i want to destroy it:
so i have written code</p>

<pre><code>while(!myqueue-&gt;empty())
{
    myqueue-&gt;pop();
}
</code></pre>

<p>please tell me is it right way to destroy it or there is any other mean to avoid memory leak .Please note that
delete myqueue is giving segmentation fault.</p>
