2
votes

I am getting the following error but I don't understand what is wrong:

Error 7 error C2440: 'initializing' : cannot convert from 'std::pair<_Ty1,_Ty2> *' to 'std::pair<_Ty1,_Ty2> *'
c:\documents and settings\vay\my documents\visual studio 2010\projects\socks\chatserver\server.h 107

This is the relevant code:

std::pair<std::string, ChatClient&> *p
     = new std::pair<std::string, ChatClient>(username, *sock );
1
This is the line : std::pair<std::string, ChatClient&> *p = new std::pair<std::string, ChatClient>(username, *sock ); - Vijay

1 Answers

4
votes

Your two pairs are different.

Remove the &:

std::pair<std::string, ChatClient> *p = new std::pair<std::string, ChatClient>(...);