std::map compilation error
I have this:
struct agents
{
Socket* agentsocket; // ptr to socket for client
DWORD dwDeviceID; // DeviceID
char szLogon[100]; // logon
};
// std::vector<agents> m_AgentsList;
std::map<long, agents> m_AgentsList;
Then for example I do a find like this:
long mydevice = 4;
std::map<long, agents>::iterator i = m_AgentsList.find(mydevice);
I then get this error on line with find as above.
error C2440: 'initializing' :
cannot convert from
'class std::_Tree<long,struct std::pair<long const ,struct
CSocketServer::agents>,struct std::map<long,struct
CSocketServer::agents,struct std::less<long>,class std::allocator<struct
CSocketServer::agents> >::_Kfn,struct std::less<long>,class
std::allocator<struct CSocketServer::agents> >::const_iterator'
to
'class std::_Tree<long,struct std::pair<long const ,struct
CSocketServer::agents>,struct std::map<long,struct
CSocketServer::agents,struct std::less<long>,class std::allocator<struct
CSocketServer::agents> >::_Kfn,struct std::less<long>,class
std::allocator<struct CSocketServer::agents> >::iterator'
No constructor could take the source type, or constructor overload
resolution was ambiguous
Error executing cl.exe.
Why?
I used in a small sample program and I could use find without problem.
Don't know why I can't get it to compile in my main program?
Angus