I’ve question to ask.
I’ve created a class called AstarPlanlama and have these 2 functions:
bool AstarPlanlama::nodeComp(const Node* lhs, const Node* rhs)
{
return lhs->F < rhs->F;
}
void AstarPlanlama::enKucukFliNodeBul(std::list<Node*> * OPEN)
{
std::list<Node*>::iterator it = std::min_element(OPEN->begin(), OPEN->end(), &AstarPlanlama::nodeComp);
OPEN->sort(&AstarPlanlama::nodeComp);
Q = OPEN->front();
OPEN->pop_front();
}
When I compile my code the error occurs in the xutility.h file.
template<class _Pr, class _Ty1, class _Ty2> inline
bool _Debug_lt_pred(_Pr _Pred,
_Ty1& _Left, _Ty2& _Right,
_Dbfile_t _File, _Dbline_t _Line)
{ // test if _Pred(_Left, _Right) and _Pred is strict weak ordering
if (!_Pred(_Left, _Right))
return (false);
else if (_Pred(_Right, _Left))
_DEBUG_ERROR2("invalid operator<", _File, _Line);
return (true);
}
Declerations of the functions:
bool nodeComp(const Node* lhs, const Node* rhs);
void enKucukFliNodeBul(std::list<Node*> * OPEN);
The error line is if (!_Pred(_Left, _Right))
What is wrong with the code?
Thank you for your returns..
My regards..
It looks like you are passing a member function as your custom comparator.
Make it
staticor usestd::bind:Member functions are special and need to be called on an object, this is why
std::bindis needed to bind to thethispointer.