mercredi 2 décembre 2020

Why is list::remove_if() giving me an error?

I was making a chess engine and I have a list of moves.

std::list<Move> moves;

I also have a function that checks if the king is under a check after a specific move.

bool Board::check_after_move(const Move& move)
{
    Board temp=*this;
    temp.DoMove(move);
    return temp.check();
}

After I generate possible moves, I filter out the illegal ones.

moves.remove_if(check_after_move);

But I get an error

'&': illegal operation on bound member function expression

How should I fix this?

Aucun commentaire:

Enregistrer un commentaire