**** Post for FREE via your newsreader at post.usenet.com ****
"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vg************@corp.supernews.com...
"Tino" <ti****@yahoo.com> wrote... Hopefully a simple question:
What is the best/safest/fastest way to clear/make empty a std::priority_queue?
std::priority_queue myqueue;
... // fill it up
// clear it:
When you say "clear it", do you mean that I need to pop off all items? I'm
worried about proper destruction of the elements of the priority_queue. If
this is the case, doesn't
while( myqueue.size() > 0 )
myqueue.pop();
do the job? But is this the fastest way to do it? For std::vector there is
std::vector::clear, and I couldn't find anything analagous for
std::priority_queue.
myqueue = std::priority_queue(); // assign an empty one to it
Victor
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=