Bonjour,
j'aimerais utiliser la fonction find_if sans prédicat "maison", et donc en l'utilisant avec une fonction membre existante.
J'ai donc fait:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
	std::vector<COperateur*>::const_iterator iter = std::find_if( m_listOp.begin(), m_listOp.end(), std::bind2nd( std::mem_fun(&COperateur::IsAddIp), addIp) );
 
avec :
	bool IsAddIp(const std::string& addIp) const {
        return (bool)(GetAddIp() == addIp);
	}

Erreur :
error C2784: 'class std::mem_fun_t<_R,_Ty> __cdecl std::mem_fun(_R (__thiscall _Ty::*)(void))' : could not deduce template argument for '<Unknown>' from 'bool (__thiscall COperateur::*)(const class std::basi
c_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const'
Selon vous d'où vient le problème ?
- encore VC6 ?
- devrais-je utiliser std::mem_fun1 du fait que ma fonction membre prend un argument ?

Merci par avance,
@+