Please bear with me if the question is silly.
The following are defined in a header file :
typedef char NAME_T[40];
struct NAME_MAPPING_T
{
NAME_T englishName;
NAME_T frenchName;
};
typedef std::vector<NAME_MAPPING_T> NAMES_DATABASE_T;
Later the need comes that a particular english name be found :
const NAMES_DATABASE_T *wordsDb;
string str;
std::find_if( wordsDb->begin(),
wordsDb->end(),
[str](const NAME_MAPPING_T &m) -> bool { return strncmp(m.englishName, str.c_str(), sizeof(m.englishName)) == 0; } );
This code (which I copy-pasted to be honest) compiles, but if I want to check the value returned by find_if(), like this :
NAMES_DATABASE_T::iterator it;
it = std::find_if(blah ..)
the code will NOT compile !
In effect the line it = std::find_if(...) will return the error :
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_Vector_const_iterator<_Myvec>' (or there is no acceptable conversion)
What is wrong ?
Thanks for your time.