Vijay
Vijay

Reputation: 2067

C++ Compiler error C2440

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 );

Upvotes: 2

Views: 2164

Answers (1)

Erik
Erik

Reputation: 91270

Your two pairs are different.

Remove the &:

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

Upvotes: 4

Related Questions