Приоритетная очередь STL
От: Аноним  
Дата: 10.10.05 20:01
Оценка:
Доброй ночи!

Нужно создать приоритетную очередь со своей функцией определяющей приоритет. Пробовал так:
#include <queue>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

enum P {one=1,two=2};

struct S{
  P p;
  string s;
};


bool criterion(const S & s1,const S & s2)
{
  return s1.p < s2.p;
}

int main()
{
   priority_queue<S,vector<S>,criterion> p;
}


Компилятор ругается:
test.cc: In function `int main()':
test.cc:23: error: type/value mismatch at argument 3 in template parameter list
   for `template<class _Tp, class _Sequence, class _Compare> class

   std::priority_queue'
test.cc:23: error:   expected a type, got `criterion'
test.cc:23: error: ISO C++ forbids declaration of `p' with no type


Подскажите, пожайлуста, в чем моя ошибка и как подправить?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.