Member Function Pointer not quite right
- by BlackDuck
I have a SpecialisedRedBlackTree class that is templated.
My Month class is not.
In my Month class I have a private member which is an instance of SpecialisedRedBlackTree:
SpecialisedRedBlackTree<Day> m_windSpeedTree;
As you can see it will take the Day class/object (please correct me on any terms I get wrong).
In my Month class, I have a method passing a method function pointer to this method:
bool Month::CompareWindSpeed(Day a, Day b) {
return ( a.GetData(WIND_SPEED_CODE) < b.GetData(WIND_SPEED_CODE)? true : false);
}
bool (Month::*myFuncPtr)(Day, Day);
myFuncPtr = &Month::CompareWindSpeed;
m_windSpeedTree.Insert(dayReading, myFuncPtr);
But because I am passing a bool (Day, Day) pointer to a templated class expecting bool (T, T)
T being part of this .... template
Error 1 error C2664: 'SpecialisedRedBlackTree<T>::Insert' : cannot convert parameter 2 from 'bool (__thiscall Month::* )(Day,Day)' to 'bool (__cdecl *)(T,T)'
Any advice?