Predicate in find_if
has to take a const reference to a type stored in container. You store a Player
type in vector
vector<Player> game_players;
Thus
[&](Player* p )
is not a correct predicate. This should be
[c_player]( const Player& p ) { return p == *c_player; }
// ^^^^^^^^^^^^^^
// to compare by value
// note: to compare by value
// bool operator==( const Player&, const Player&)
// must be defined
[c_player]( const Player& p ) { return &p == c_player; }
// ^^^^^^^^^^^^^^
// to compare by address
// note: address of c_player
// has to be valid (not invalidated by vector through resizing, erasing, etc)
So you can write:
vector<Player>::iterator iter;
iter = find_if( game_players.begin(), game_players.end(),
[c_player]( const Player& p ) { return p == *c_player;});