I am trying to create a map full of strings as keys and integers as values. The problem begins when I try and search with it. Can someone tell me where I went wrong? Is it that I have two Maps in the same statement?
invale is "ale"
roomno = 2;
// roomlist is a map
// rinventory is another map
if( roomlist[roomno].rinventory.find( invale ) != map<string, int>::end());
The error I get follows. What overloaded function? It really is a lengthy error.
error C2668: 'std::_Tree<_Traits>::end' : ambiguous call to overloaded function
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\xtree(569): could be 'std::_Tree<_Traits>::const_iterator std::_Tree<_Traits>::end(void) const'
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\xtree(564): or 'std::_Tree<_Traits>::iterator std::_Tree<_Traits>::end(void)'
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,int,std::less<std::string>,std::allocator<std::pair<const std::string,int>>,false>
1> ]
1> while trying to match the argument list '(void)'
Thank you in advance.
Try changing it to: