Std :: bind no viable conversion
I created a pathfind algorithm where I can set a heuristic. But I am using
function<int (Point2i origin, Point2i destiny)> heuristicFunc;
As my function pointer and I want to initialize it with my default elite.
So:
Pathfind.h
class Pathfind{
private:
function<int (Point2i origin, Point2i destiny)> heuristicFunc;
int hMethod(Point2i origin, Point2i destiny);
public:
Pathfind();
}
Pathfind.cpp
Pathfind::Pathfind(){
//1st try
this->heuristicFunc=&Pathfind::hMethod;
//2nd try
this->heuristicFunc=std::bind(&Pathfind::hMethod, this);
}
But it returns the same error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/C++/v1/functional: 1472:15: Candidate function not viable: unknown conversion from 'int (Core :: Pathfind :: *) (Point2i, Point2i) 'to' const std :: __ 1 :: function, sf :: Point2)> 'for 1st argument
why is it trying to convert from int (Core :: Pathfind :: *)?
Thank.
+3
source to share