Conflict when trying to initialize a priority queue using another comparison functor other than the one declared in the template signature
<p>I implemented a templated priority queue:</p>

<pre><code>template&lt;typename TYPE, typename COMP_FUNCTOR = std::less&lt;TYPE&gt;&gt;
class heap_priority_queue : public priority_queue&lt;TYPE, COMP_FUNCTOR&gt; {
public:
    typedef unsigned size_type;

    template&lt;typename InputIterator&gt;
    heap_priority_queue(InputIterator start, InputIterator end, COMP_FUNCTOR comp = COMP_FUNCTOR()); 
    /* other methods*/
};

template&lt;typename TYPE, typename COMP_FUNCTOR&gt;
template&lt;typename InputIterator&gt;
heap_priority_queue&lt;TYPE, COMP_FUNCTOR&gt;::heap_priority_queue (
    InputIterator start, InputIterator end, COMP_FUNCTOR comp) {

    for(auto it = start; it != end; ++it) {
        data.push_back(*it);
    }
    fix();
    this-&gt;compare = comp;
} 
</code></pre>

<p>The default comparison functor defined in the template signature is std::less, but in the constructor of this priority_queue, it seems we can pass another custom COMP_FUNCTOR comp as the 3rd arguments, or we are using the COMP_FUNCTOR declared in the template signature? But when I tried to pass another COMP_FUNCTOR other than the one declared in the template signature as the third argument conflict happens,why? Here is the code:</p>

<pre><code>class isgreater {
public:
    isgreater() {};
    bool operator () (int a, int b) {
        return a &gt; b;
    }
};
int main() {
    int my_ints[] = {1, 3, 5, 7, 9};
    vector&lt;int&gt; v(my_ints, my_ints + sizeof(my_ints)/sizeof(int));

    // wrong, default COMP_FUNCOR is std::less, which is different from isgreater;
    heap_priority_queue&lt;int&gt; sq(v.begin(), v.end(), isgreater());

    // right, no conflict
    heap_priority_queue&lt;int, isgreater&gt; back_up(v.begin(), v.end(), isgreater());
</code></pre>

<p>Why should the object we pass in as the third argument of the constructor  be the same as the one we declare in the template signature? It seems to me make no sense to keep the third argument of the constructor since we must use the one defined in the template signature...Thank you.</p>