|
From: Sebastien M. <seb...@te...> - 2002-11-29 01:44:46
|
Hello,
Of course it doesn't work!!!
The second arguement of your template MUST be a vector and not a Compare object.
priority_queue<T, Sequence, Compare>
Here is the definition of the priority_queue template.
Sequence is by default vector, is you are ok to use vector type, so
define your template in this way:
priority_queue<int, vector<int>, less<int> > IntPQueue;
And it works ;o)
Happy coding,
Sebastien.
On Thu, Nov 28, 2002 at 04:11:12PM -0300, Marcos Carrard wrote:
> Hi!
>
> I have a little problem with Dev in STL library. The problem is in
> priority_queue with declaration of function object for relational test.
> The source code is:
>
> #include <iostream>
> #include <queue>
>
> using namespace std;
>
> int main()
> {
> typedef priority_queue< int, less<int> > IntPQueue; // HERE!!!!
> IntPQueue ipqueue;
> ipqueue.push (31);
> ipqueue.push (87);
> ipqueue.push (13);
> ipqueue.push (29);
> while (!ipqueue.empty())
> {
> cout << ipqueue.top() << endl;
> ipqueue.pop();
> }
> return 0;
> }
>
> What is doing?
>
> Thanks,
>
> Marcos
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Get the new Palm Tungsten T
> handheld. Power & Color in a compact size!
> http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
--
Time remaining: 30 weeks 4 days 4 hours 57 minutes
|