jeudi 2 mars 2017

Issue with template method definition - error C2244: unable to match function definition to an existing declaration

I have two template classes:

template<typename D, typename V, typename Comp>
class pQueueNodeComp;

and:

template <typename D, typename V, typename Comp>
class pQueueComp;

Inside pQueueComp I have a method declared as such:

pQueueNodeComp<D, V,Comp>* lowest();

and here's the definition:

template <typename D, typename V, typename Comp>
pQueueNodeComp<D, V, Comp>* pQueueComp<D, V, Comp>::lowest() {
    return binaryHeap[0]; //binaryHeap is a vector<pQueueNodeComp<D, V, Comp>*>
}

I'm getting the following error on Visual Studio 2015:

1>d:\github\pqueue\pqueue\pqueuecomp.h(163): error C2244: 'pQueueComp<D,V,Comp>::lowest': unable to match function definition to an existing declaration
1>  d:\github\pqueue\pqueue\pqueuecomp.h(161): note: see declaration of 'pQueueComp<D,V,Comp>::lowest'
1>  d:\github\pqueue\pqueue\pqueuecomp.h(163): note: definition
1>  d:\github\pqueue\pqueue\pqueuecomp.h(163): note: 'pQueueNodeComp<D,V,Comp> *pQueueComp<D,V,Comp>::lowest(void)'
1>  d:\github\pqueue\pqueue\pqueuecomp.h(163): note: existing declarations
1>  d:\github\pqueue\pqueue\pqueuecomp.h(163): note: 'pQueueNodeComp<D,V,Comp> *pQueueComp<D,V,Comp>::lowest(void)'

It looks to me like the declaration matches the definition. Am I going crazy?

Aucun commentaire:

Enregistrer un commentaire