A
Anonymous
I have map variable that maps ids (unsigned int) to objects. Each object
has a Name() method.
I want to use std::find_if to fetch the object that name matches.
I defined my predicate like this:
class NameMatch
{
public:
inline NameMatch ( const std::string& name ) : m_name ( name )
{}
inline bool operator() ( const char* systemname ) const
{
return !stricmp(m_name.c_str(), systemname) ;
}
inline ~NameMatch(){}
private:
std::string m_name ;
};
I got the ff error:
error C2664: 'bool `anonymous-namespace'::NameMatch:
perator ()(const
char *) const' : cannot convert parameter 1 from 'std:
air<_Ty1,_Ty2>'
to 'const char *'
How may I implement this ?
has a Name() method.
I want to use std::find_if to fetch the object that name matches.
I defined my predicate like this:
class NameMatch
{
public:
inline NameMatch ( const std::string& name ) : m_name ( name )
{}
inline bool operator() ( const char* systemname ) const
{
return !stricmp(m_name.c_str(), systemname) ;
}
inline ~NameMatch(){}
private:
std::string m_name ;
};
I got the ff error:
error C2664: 'bool `anonymous-namespace'::NameMatch:
char *) const' : cannot convert parameter 1 from 'std:
to 'const char *'
How may I implement this ?