IceProxy : passing a method pointer as a variable

in Help Center
I get the following compiler error for the listed code :
error: address of overloaded function with no contextual type information
I have an ICE method :
Any help appreciated.
thanks
Matt
error: address of overloaded function with no contextual type information
I have an ICE method :
module NAMESPACE { class MyClass { void myFunc(MyClass* proxy) sequence<string> getStringVector(const string &key); } }I am trying to pass a pointer to this method as a variable using the proxy :
void MyClassI<BASECLASS>::myFunc(const NAMESPACE::MyClassPrx& proxy, const Ice::Current&) { myOtherFunc((vector<string> (*)(const string&)) (&IceProxy::NAMESPACE::MyClass::getStringVector))l }
Any help appreciated.
thanks
Matt
0
Comments
Welcome to our forums. slice2cpp generates two overloaded functions for each Slice operation (e.g. getStringVector), one with a context parameter (as last parameter), and one without.
What is the declaration of myOtherFunc?
Best regards,
Bernard
To answer your question :
myOtherFunc is actually a method of a different class. It is called like so :
e->myOtherFunc
where e is a pointer member variable.
The compiler actually reports the problem when I instantiate the templates :
template class MyClassI<TemplateClass1>;
template class MyClassI<TemplateClass2>;
line #1 : instantiated from here
line #1b error: address of overloaded function with no contextual type information
line #2 : instantiated from here
line #2b error: address of overloaded function with no contextual type information
where line #1 matches the template and #1b matches the myOtherFunc call.
NAMESPACE::stringVectorT (IceProxy::NAMESPACE::MyClass::*f)(const string &)=(&IceProxy::NAMESPACE::MyClass::getStringVector);
Then I use 'f' in my method :
myOtherFunc(f);
I now have the problem where the compiler wants the original method to be called with an Ice::Current variable :
void MyClassI<BASECLASS>::myFunc(const NAMESPACE::MyClassPrx& proxy, const Ice::Current&);
Where do I get Ice::Current from ?
The compiler will not let me call myFunc(proxy);
It is asking me to provide 'Ice::Current'
thanks
Matt
Based in Ice Hello demo something like this should work.
I think my problem was that the instance was templated and the compiler couldn't map to the method to call ... because of template confusion ... I tried many methods including double casts to override the problem... but to no avail !
Matt