Hi,
I have the following code:
---------------
#include
#include
#include <map>
#include <string>
class Foo {
public:
void Function3() const
{
int i =2;
};
const std::string Function4() const
{
return "";
};
unsigned int Function5() const
{
return 2;
};
};
std::map functions;
Foo foo;
functions["Function3"] = boost::bind(&Foo::Function3, &foo);
functions["Function4"] = boost::bind(&Foo::Function4, &foo);
functions["Function5"] = boost::bind(&Foo::Function5, &foo);
// call the functions
functions["Function4"]();
--------------
Calling the correct function with the entries in the map is no problem, but
how can I get the return value. I tried something like that:
"unsigned int i = functions["Function5"]();" but sadly it doesnt work, maybe
cause in the map I declared for the return value "void"?
How can I have such a map where to have functions with different return
types in it and to get the return value after a call of the function through
the map?
Thanks in advance
Julia