Generic Function

I want to write a class(Generic Function) to store the function, its parameters and its reture type.

//what I need
1
2
3
4
5
6
7
8
9

GenericFunction gf = std::function([](int data){std::cout<<data<<std::endl;});
gf(1);//output the result.
gf(std::string(""));//ignore it or throw an exception.

gf = [](int, double){};
gf(2,2.0);
gf(std::string(""), std::string(""));//ignore it or throw an exception.



Any tool(Macro, inheritance, template) can be used.
Topic archived. No new replies allowed.