I am using the map.find(key) and map.end() functions in an if statement:
if( p_Repos->returnTypeMap().find(tc[0]) != p_Repos->returnTypeMap().end() )
But it doesn't work, and I get a Microsoft Visual C++ Runtime Library error that tells me "Expression: list iterators incompatible". tc[0] is just a string, and the key position in my map is a string.
But, they should be compatible, right?
Any help is greatly appreciated.
Thanks, Tom
Edit: Based on an answer found here: Finding value in unordered_map, I'm lead to believe this should def work.
Second Edit:
Here is the returnTypeMap() function:
std::unordered_map <std::string, std::pair<std::string, std::string>> returnTypeMap()
{
return typeTable;
}
Here is the definition of my map:
std::unordered_map <std::string, std::pair<std::string, std::string>> typeTable;
returnTypeMap()
return by value? If so, each iterator is pointing in to a completely differentmap
. – Mankarseif( p_Repos->returnTypeMap().count(tc[0]) > 0 )
instead. – leewz