STL find error with STL map
I've used maps before with no troubles but for some reason I'm getting an error now with this code. Perhaps I've missed something obvious but any help would be appreciated.
Code:
...
...
//iterator for find
std::map<DWORD,STLListNode *>::iterator it;
//If it==end of map then value is not in map
bool bLoop=true;
do
{
dwID=r.Random(65535);
it=std::find(m_mapRes.begin(),
m_mapRes.end(),
dwID);
if (it==m_mapRes.end()) bLoop=false;
} while (bLoop);
...
...
Class code
Code:
struct STLListNode
{
CResource *pResource;
STLListNode *pNext;
STLListNode *pPrev;
};
class CResMgr
{
private:
CResMgr(const CResMgr &) { }
CResMgr &operator=(const CResMgr &) { }
protected:
IDirect3DDevice9 *m_spDevice;
ListNode *m_pRoot;
STLListNode *m_pTop;
std::map<DWORD,STLListNode *> m_mapRes;
....
When I comment out the bolded line of code I do not get the error. The error is coming from <algorithm> and is:
Quote:
e:\program files\microsoft visual studio 8\vc\include\algorithm(40) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::pair<_Ty1,_Ty2>' (or there is no acceptable conversion)
with
[
_Ty1=const DWORD,
_Ty2=STLListNode *
]
e:\program files\microsoft platform sdk\include\guiddef.h(192): could be 'int operator ==(const GUID &,const GUID &)' [found using argument-dependent lookup]
while trying to match the argument list '(std::pair<_Ty1,_Ty2>, const DWORD)'
with
[
_Ty1=const DWORD,
_Ty2=STLListNode *
]
e:\program files\microsoft visual studio 8\vc\include\algorithm(74) : see reference to function template instantiation '_InIt std::_Find<std::_Tree<_Traits>::iterator,_Ty>(_InI t,_InIt,const _Ty &)' being compiled
with
[
_InIt=std::_Tree<std::_Tmap_traits<DWORD,STLListNo de *,std::less<DWORD>,std::allocator<std::pair<const DWORD,STLListNode *>>,false>>::iterator,
_Traits=std::_Tmap_traits<DWORD,STLListNode *,std::less<DWORD>,std::allocator<std::pair<const DWORD,STLListNode *>>,false>,
_Ty=DWORD
]
e:\msvc 2005 projects\starx\cresmgr.cpp(27) : see reference to function template instantiation '_InIt std::find<std::_Tree<_Traits>::iterator,DWORD>(_In It,_InIt,const _Ty &)' being compiled
with
[
_InIt=std::_Tree<std::_Tmap_traits<DWORD,STLListNo de *,std::less<DWORD>,std::allocator<std::pair<const DWORD,STLListNode *>>,false>>::iterator,
_Traits=std::_Tmap_traits<DWORD,STLListNode *,std::less<DWORD>,std::allocator<std::pair<const DWORD,STLListNode *>>,false>,
_Ty=DWORD
]