Archived
This forum has been archived. Please start a new discussion on GitHub.
use ICE proxy in STL map ,error C2440,C2439
I want extend the chat sample in ICE package ,so I define below slice file:
I want to use CmnService class in server ,which manage the callback proxy of the client.
So I define a type in my C++ class:
typedef map<string, RemoteControlable*> StringRemoteControlableProxyMap;
I compile these code in VC++2005,bug it report error:
erro 1 error C2440: “init”: can not convert “IceInternal::ProxyHandle<T> ” to“RemoteControlable *” c:\program files\microsoft visual studio 8\vc\include\utility 44
error 2 error C2439: “std::pair<_Ty1,_Ty2>::second”: can not init member c:\program files\microsoft visual studio 8\vc\include\utility 44
can give me some help?
interface RemoteControlable
{
int excuteCommand(int cmd);
int excuteCommandWithContent(int cmd,string cmdContent);
int putFile(string name,ByteSeq bytes);
ByteSeq readFile(string name, int offset, int num);
void writeFile(string name, int offset, ByteSeq bytes);
};
interface CmnService extends RemoteControlable
{
void initiateRemoteControl(RemoteControlable* proxy,string clintId);
};
I want to use CmnService class in server ,which manage the callback proxy of the client.
So I define a type in my C++ class:
typedef map<string, RemoteControlable*> StringRemoteControlableProxyMap;
.....
void CmnServiceI::initiateRemoteControl(const RemoteControlablePrx& proxy, const ::std::string& str, const ::Ice::Context* c)
{
string key(str);
StringRemoteControlableProxyMap::iterator pos=this->connectedClients.find(key);
if(pos!=this->connectedClients.end())
{
cout<<"RemoteControlablePrx:"<<str<<"has exist."<<endl;
return;
}
this->connectedClients.insert(
make_pair(key,const_cast<RemoteControlablePrx*>(&proxy))
);
cout<<"initiateRemoteControl:"<<str<<endl;
}
I compile these code in VC++2005,bug it report error:
erro 1 error C2440: “init”: can not convert “IceInternal::ProxyHandle<T> ” to“RemoteControlable *” c:\program files\microsoft visual studio 8\vc\include\utility 44
error 2 error C2439: “std::pair<_Ty1,_Ty2>::second”: can not init member c:\program files\microsoft visual studio 8\vc\include\utility 44
can give me some help?
0
Comments
-
question solved
sorry,I found my error and correct!
::IceInternal::ProxyHandle<... > is a smart pointer!
typedef map<string,RemoteControlablePrx> StringRemoteControlablePrxMap;
worked fine!
Thanks very much!
ICE is an excellent project!!!0