From 294575141627013332 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,ba96c237e128ed5a X-Google-Attributes: gidf78e5,public From: "P.J. Plauger" Subject: Re: STL priority queue search Date: 1998/07/07 Message-ID: <01bda93f$5eb9a360$8a1ec2d0@porky>#1/1 X-Deja-AN: 369127979 Approved: stephen.clamage@sun.com (comp.std.c++) References: <6nirma$dng$2@news.utdallas.edu> Originator: clamage@taumet X-NNTP-Posting-Host: 208.194.30.138 Organization: Diunkumware, Ltd. Newsgroups: comp.std.c++ Don Montgomery wrote in article ... > On 3 Jul 1998, Don Montgomery wrote: > !Hi, does anyone know the (a) good way to do a linear > !(or, for that matter, a random access) search on PQs > !in STL? > > Let me re-phrase: is it possible/how do you do it: get an > iterator returned from a > > priority-queue >? > > (Purpose: to check for non-key flag fields in an event list, > with the possibility of User-defined-type deletion from the > priority-queue, or perhaps just setting an `invalid flag.') You can't get an iterator that lets you walk through a priority_queue. By design, it is a container adapter with a limited repertory of operations defined, to protect the abstraction. Sounds like what you want may be a map. It's kept in order, and you can walk the sequence with iterators, erasing as your heart desires. P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.com [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]