About Priority-Queue Constructors

Hi all, I'm having a question about priority-queue. Its constructors are like this:
1
2
3
4
5
6
explicit priority_queue ( const Compare& x = Compare(),
                          const Container& y = Container() );
template <class InputIterator>
         priority_queue ( InputIterator first, InputIterator last,
                          const Compare& x = Compare(),
                          const Container& y = Container() );


So how can I construct an object using the second version. I try like this:
1
2
3
4
	const int a[] = {1, 2, 3, 4, 5};
	priority_queue <int> MyPQ1(a, a+5);	//Ok
	priority_queue <int> MyPQ2(greater <int>);	//Ok
	priority_queue <int> MyPQ3(a, a+5, greater <int>);	//Error here 


Why is the third declaration wrong???
closed account (DSLq5Di1)
priority_queue <int> MyPQ2(greater <int>); //Ok Also an error.

priority_queue <int, vector<int>, greater<int> > MyPQ3(a, a+5); //Ok
Topic archived. No new replies allowed.