I would like to create a wrapper class of a std::function (WrapperFunction) that doesn't need templates to be built. So, I'm wandering if it is possible to create a std::function and decompose it in its return type, arguments and function (lambda) and passing them to the constructor of WrapperFunction. The main task of WrapperFunction class would be to store these three data and return them in a proper way (for example through three getters). The will is to instantiate and pass around this class to not propagate templates needed to make a std::function.
A not working pseudo-code example to show the idea could be:
auto f = std::function<bool(int, int)>([](int a, int b){ return a == b;});
ReturnType rt = f.give_me_return_type;
Arguments args = f.give_me_args;
Lambda lambda = f.five_me_lambda;
auto functionWrapper = FunctionWrapper(rt, args, lambda);
auto result = std::function<functionWrapper.getReturnType()(functionWrapper.getArguments())>(functionWrapper.getLambda());
Is possible to do that? or does exist something similar?
Aucun commentaire:
Enregistrer un commentaire